bgp: fix send_notificaiton crash

self._localname() is invalid before a connection establishes.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
FUJITA Tomonori 2014-07-03 15:18:36 +09:00
parent d884524db5
commit 0c7952cfd7
1 changed files with 3 additions and 2 deletions

View File

@ -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):