summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-07-03 15:18:36 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2014-07-03 15:21:19 +0900
commit0c7952cfd7c219944236a191555a0b621e07b12b (patch)
tree830764b1d5d9b2f85f3c4eeb3d1f8bb8af7d4e3c
parentd884524db5ad6e0e84266cd1742e6db510fb0bce (diff)
bgp: fix send_notificaiton crash
self._localname() is invalid before a connection establishes. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/services/protocols/bgp/speaker.py5
1 files 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):