From 66759d76ddb74e3ea0ea03ddc8b6f81b70178528 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Wed, 23 Apr 2014 11:55:07 +0900 Subject: bgp: fix connect timeout error RROR 2014-04-23 11:54:59,239 hub 58 hub: uncaught exception: Traceback (most recent c\ all last): File "/Users/fujita/git/ryu/ryu/lib/hub.py", line 50, in _launch func(*args, **kwargs) File "/Users/fujita/git/ryu/ryu/services/protocols/bgp/base.py", line 239, in start self._run(*args, **kwargs) File "/Users/fujita/git/ryu/ryu/services/protocols/bgp/peer.py", line 448, in _run self._connect_loop(client_factory) File "/Users/fujita/git/ryu/ryu/services/protocols/bgp/peer.py", line 820, in _conne\ ct_loop bind_address=bind_addr) File "/Users/fujita/git/ryu/ryu/services/protocols/bgp/base.py", line 354, in _conne\ ct_tcp return sock UnboundLocalError: local variable 'sock' referenced before assignment Signed-off-by: FUJITA Tomonori --- ryu/services/protocols/bgp/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ryu/services/protocols/bgp/base.py b/ryu/services/protocols/bgp/base.py index 571826f5..9eff703a 100644 --- a/ryu/services/protocols/bgp/base.py +++ b/ryu/services/protocols/bgp/base.py @@ -17,6 +17,7 @@ """ import abc import logging +import socket import time import traceback import weakref @@ -340,7 +341,7 @@ class Activity(object): """ LOG.debug('Connect TCP called for %s:%s' % (peer_addr[0], peer_addr[1])) - with Timeout(time_out, False): + with Timeout(time_out, socket.error): sock = hub.connect(peer_addr, bind=bind_address) if sock: # Connection name for pro-active connection is made up -- cgit v1.2.3