Loading ccserver/ccserver.py +13 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,8 @@ class CCServer(object): # Create the connection manager: self.manager = SimpleSslRpcServer(sock, certfile=certfile, keyfile=keyfile, default_handler=WelcomeHandler(self)) default_handler=WelcomeHandler(self), on_disconnect='on_disconnect') def iterrole(self, role): ''' Loading @@ -71,6 +72,17 @@ class CCServer(object): self._connected[login] = CCClient(login, role, self, connection) def unregister(self, connection): ''' Unregister an already connected account. :param connection: the connection of the client to unregister ''' client = self.search_client_by_connection(connection) if client.login in self._connected: del self._connected[client.login] def search_client_by_connection(self, connection): ''' Search a connected client by it connection. If no client is found, Loading ccserver/handlers.py +7 −2 Original line number Diff line number Diff line Loading @@ -42,14 +42,19 @@ class CCHandler(RpcHandler): return cmd_list class HypervisorHandler(CCHandler): class OnlineCCHandler(CCHandler): def on_disconnect(self, connection): self._server.unregister(connection) class HypervisorHandler(OnlineCCHandler): ''' Handler binded to 'node' role. ''' role_name = 'hypervisor' class ClientHandler(CCHandler): class ClientHandler(OnlineCCHandler): ''' Handler binded to 'cli' role. ''' Loading Loading
ccserver/ccserver.py +13 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,8 @@ class CCServer(object): # Create the connection manager: self.manager = SimpleSslRpcServer(sock, certfile=certfile, keyfile=keyfile, default_handler=WelcomeHandler(self)) default_handler=WelcomeHandler(self), on_disconnect='on_disconnect') def iterrole(self, role): ''' Loading @@ -71,6 +72,17 @@ class CCServer(object): self._connected[login] = CCClient(login, role, self, connection) def unregister(self, connection): ''' Unregister an already connected account. :param connection: the connection of the client to unregister ''' client = self.search_client_by_connection(connection) if client.login in self._connected: del self._connected[client.login] def search_client_by_connection(self, connection): ''' Search a connected client by it connection. If no client is found, Loading
ccserver/handlers.py +7 −2 Original line number Diff line number Diff line Loading @@ -42,14 +42,19 @@ class CCHandler(RpcHandler): return cmd_list class HypervisorHandler(CCHandler): class OnlineCCHandler(CCHandler): def on_disconnect(self, connection): self._server.unregister(connection) class HypervisorHandler(OnlineCCHandler): ''' Handler binded to 'node' role. ''' role_name = 'hypervisor' class ClientHandler(CCHandler): class ClientHandler(OnlineCCHandler): ''' Handler binded to 'cli' role. ''' Loading