Loading cloudcontrol/node/node.py +18 −5 Original line number Diff line number Diff line Loading @@ -128,7 +128,7 @@ class RPCStartHandler(Thread): logger.error('Error while authenticating with cc-server: %s("%s")', error['exception'], error.get('message', '')) # try to reconnect in 5 seconds self.set_reconnect() return # set handler according to which role was returned by the cc-server Loading Loading @@ -165,15 +165,28 @@ class RPCStartHandler(Thread): self.loop.register_plugin(self.loop.main_plugin) else: logger.error('Failed authentication, role returned: %s', response) self.set_reconnect() return # we retry while it fails self.stop() logger.info('Successfully authenticated with role %s', str(response)) self.auth_id = None def set_reconnect(self): self.loop.role = None self.auth_id = None # we also close the previously opened plugins self.loop.close_plugins() return # we retry while it fails self.timer.stop() # we don't directly shutdown the rpc connection as the current # callback is not fully completed, thus it will be called again self.timer = self.loop.evloop.timer(.5, .0, self.handle_reconnect) self.timer.start() def handle_reconnect(self, *args): self.stop() logger.info('Successfully authenticated with role %s', str(response)) self.auth_id = None self.rpc_con.shutdown() self.loop.restart_rpc_connection() class MainLoop(object): Loading Loading
cloudcontrol/node/node.py +18 −5 Original line number Diff line number Diff line Loading @@ -128,7 +128,7 @@ class RPCStartHandler(Thread): logger.error('Error while authenticating with cc-server: %s("%s")', error['exception'], error.get('message', '')) # try to reconnect in 5 seconds self.set_reconnect() return # set handler according to which role was returned by the cc-server Loading Loading @@ -165,15 +165,28 @@ class RPCStartHandler(Thread): self.loop.register_plugin(self.loop.main_plugin) else: logger.error('Failed authentication, role returned: %s', response) self.set_reconnect() return # we retry while it fails self.stop() logger.info('Successfully authenticated with role %s', str(response)) self.auth_id = None def set_reconnect(self): self.loop.role = None self.auth_id = None # we also close the previously opened plugins self.loop.close_plugins() return # we retry while it fails self.timer.stop() # we don't directly shutdown the rpc connection as the current # callback is not fully completed, thus it will be called again self.timer = self.loop.evloop.timer(.5, .0, self.handle_reconnect) self.timer.start() def handle_reconnect(self, *args): self.stop() logger.info('Successfully authenticated with role %s', str(response)) self.auth_id = None self.rpc_con.shutdown() self.loop.restart_rpc_connection() class MainLoop(object): Loading