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

View File

@ -362,6 +362,7 @@ class BgpProtocol(Protocol, Activity):
reason = notification.reason reason = notification.reason
self._send_with_lock(notification) self._send_with_lock(notification)
self._signal_bus.bgp_error(self._peer, code, subcode, reason) self._signal_bus.bgp_error(self._peer, code, subcode, reason)
if len(self._localname()):
LOG.error('Sent notification to %r >> %s' % (self._localname(), LOG.error('Sent notification to %r >> %s' % (self._localname(),
notification)) notification))
self._socket.close() self._socket.close()