1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-05 09:17:54 +03:00

fixing actor on exit

This commit is contained in:
Adolfo Gómez García 2020-01-20 17:33:10 +01:00
parent 45429027bf
commit 525fa6e71c
2 changed files with 14 additions and 4 deletions

View File

@ -148,7 +148,7 @@ class CommonService: # pylint: disable=too-many-instance-attributes
self._certificate = self._api.ready(self._cfg.own_token, self._secret, srvInterface.ip, rest.LISTEN_PORT)
self._ready = True
except rest.RESTConnectionError as e:
logger.error('Error en ready: %s', e)
logger.error('Error en ready: %s -- %s', e, self._isAlive)
if not logged: # Only log connection problems ONCE
logged = True
logger.error('Error connecting with UDS Broker')
@ -383,6 +383,13 @@ class CommonService: # pylint: disable=too-many-instance-attributes
# ****************************************
# Methods that CAN BE overriden by actors
# ****************************************
def idle(self) -> None:
'''
When needs to "pump" messages for example on Windows...
'''
return
def doWait(self, miliseconds: int) -> None:
'''
Invoked to wait a bit

View File

@ -204,6 +204,9 @@ class UDSActorSvc(win32serviceutil.ServiceFramework, CommonService):
except Exception as e:
logger.error('Exception removing user from Remote Desktop Users: {}'.format(e))
def idle(self) -> None:
pythoncom.PumpWaitingMessages() # pylint: disable=no-member
def SvcDoRun(self) -> None: # pylint: disable=too-many-statements, too-many-branches
'''
Main service loop
@ -221,6 +224,9 @@ class UDSActorSvc(win32serviceutil.ServiceFramework, CommonService):
win32event.WaitForSingleObject(self._hWaitStop, 5000)
return # Stop daemon if initializes told to do so
# Initialization is done, set machine to ready for UDS, communicate urls, etc...
self.setReady()
# # ********************************
# # * Registers SENS subscriptions *
# # ********************************
@ -243,9 +249,6 @@ class UDSActorSvc(win32serviceutil.ServiceFramework, CommonService):
# logger.debug('Registered SENS')
# logger.debug('Initialized, setting ready')
# Initialization is done, set machine to ready for UDS, communicate urls, etc...
self.setReady()
# *********************
# * Main Service loop *
# *********************