cosmetic: early exit instead of if-cascade
It appears that during some error conditions, the socket will not be in the tcp socket debug tracking list, and on top of an exception this barfs as well. Let's not care about the tcp debug list and avoid confusing error messages. Change-Id: Ib7b0e45fa1f5551da2fc81b71dcc227eee533f44
This commit is contained in:
parent
cb320b8ddf
commit
e349320992
|
@ -70,14 +70,16 @@ class VTYInteract(object):
|
||||||
|
|
||||||
def _close_socket(self):
|
def _close_socket(self):
|
||||||
global debug_tcp_sockets
|
global debug_tcp_sockets
|
||||||
if self.socket:
|
if self.socket is None:
|
||||||
if debug_tcp_sockets:
|
return
|
||||||
VTYInteract.all_sockets.remove(self.socket)
|
|
||||||
print "Socket: closing %s:%d %r (%d sockets open)" % (
|
if debug_tcp_sockets:
|
||||||
self.host, self.port, self.socket,
|
VTYInteract.all_sockets.remove(self.socket)
|
||||||
len(VTYInteract.all_sockets))
|
print "Socket: closing %s:%d %r (%d sockets open)" % (
|
||||||
self.socket.close()
|
self.host, self.port, self.socket,
|
||||||
self.socket = None
|
len(VTYInteract.all_sockets))
|
||||||
|
self.socket.close()
|
||||||
|
self.socket = None
|
||||||
|
|
||||||
def _is_end(self, text, ends):
|
def _is_end(self, text, ends):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue