From 0c7952cfd7c219944236a191555a0b621e07b12b Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Thu, 3 Jul 2014 15:18:36 +0900 Subject: [PATCH] bgp: fix send_notificaiton crash self._localname() is invalid before a connection establishes. Signed-off-by: FUJITA Tomonori --- ryu/services/protocols/bgp/speaker.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ryu/services/protocols/bgp/speaker.py b/ryu/services/protocols/bgp/speaker.py index f276b833..fc7ae9de 100644 --- a/ryu/services/protocols/bgp/speaker.py +++ b/ryu/services/protocols/bgp/speaker.py @@ -362,8 +362,9 @@ class BgpProtocol(Protocol, Activity): reason = notification.reason self._send_with_lock(notification) self._signal_bus.bgp_error(self._peer, code, subcode, reason) - LOG.error('Sent notification to %r >> %s' % (self._localname(), - notification)) + if len(self._localname()): + LOG.error('Sent notification to %r >> %s' % (self._localname(), + notification)) self._socket.close() def _send_with_lock(self, msg):