Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dbe45a4 commit d2106f2Copy full SHA for d2106f2
1 file changed
lib/core/common.py
@@ -1993,11 +1993,16 @@ def getLocalIP():
1993
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
1994
s.connect((conf.hostname, conf.port))
1995
retVal, _ = s.getsockname()
1996
- s.close()
1997
except:
1998
debugMsg = "there was an error in opening socket "
1999
debugMsg += "connection toward '%s'" % conf.hostname
2000
logger.debug(debugMsg)
+ finally:
2001
+ if s:
2002
+ try:
2003
+ s.close()
2004
+ except:
2005
+ pass
2006
2007
return retVal
2008
0 commit comments