minor update

This commit is contained in:
Miroslav Stampar 2010-11-04 12:51:04 +00:00
parent 63af5444fd
commit 3aba0b1bec

View File

@ -928,12 +928,18 @@ def getDelayQuery(andCond=False):
return query
def getLocalIP():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((conf.hostname, conf.port))
ip, _ = s.getsockname()
s.close()
retVal = None
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((conf.hostname, conf.port))
retVal, _ = s.getsockname()
s.close()
except:
debugMsg = "there was an error in opening socket "
debugMsg += "connection toward '%s'" % conf.hostname
logger.debug(debugMsg)
return ip
return retVal
def getRemoteIP():
return socket.gethostbyname(conf.hostname)