1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-03-13 08:58:35 +03:00

A couple of minor fixes

This commit is contained in:
Adolfo Gómez García 2015-04-29 17:17:06 +02:00
parent 60556ad4ec
commit 15554ab08f
2 changed files with 4 additions and 3 deletions

View File

@ -196,7 +196,7 @@ class CommonService(object):
return True
def checkIpsChanged(self):
if self.api.uuid is None:
if self.api is None or self.api.uuid is None:
return # Not connected
netInfo = tuple(operations.getNetworkInfo())
for i in netInfo:
@ -207,7 +207,7 @@ class CommonService(object):
# Notifies all interfaces IPs
self.api.notifyIpChanges(((v.mac, v.ip) for v in netInfo))
# Regenerates Known ips
self.knownIps = dict(((i.mac, i.ip) for i in netInfo))
self.knownIps = dict(((v.mac, v.ip) for v in netInfo))
except Exception as e:
logger.warn('Got an error notifiying IPs to broker: {} (will retry in a bit)'.format(e.message.decode('windows-1250', 'ignore')))

View File

@ -289,7 +289,8 @@ class UDSActorSvc(win32serviceutil.ServiceFramework, CommonService):
# Process SENS messages, This will be a bit asyncronous (1 second
# delay)
pythoncom.PumpWaitingMessages()
if counter % 10 == 0:
if counter >= 60: # Once every minute
counter = 0
self.checkIpsChanged()
# In milliseconds, will break
win32event.WaitForSingleObject(self.hWaitStop, 1000)