class ClientThread(BaseRequestHandler): """ RequestHandler's descendant class for our server. An object of this class is created for each connection to the server. We override the "handle" method and communicate with the client in it. """ __handler = None def setup(self): pass def handle(self): try: if HandlerClass: log.debug('Protocol handler: %s', HandlerClass.__doc__) self.__handler = HandlerClass(pipe.Manager(), self) self.__handler.dispatch() else: log.error('No protocol handlers found!') except Exception as E: log.error("Dispatch error: %s", traceback.format_exc()) def finish(self): log.debug('ClientThread finish') if self.__handler: log.debug('Delete handler: %s', self.__handler.__class__) del self.__handler
def handle(self): try: if HandlerClass: log.debug('Protocol handler: %s', HandlerClass.__doc__) self.__handler = HandlerClass(pipe.Manager(), self) self.__handler.dispatch() else: log.error('No protocol handlers found!') except Exception as E: log.error("Dispatch error: %s", traceback.format_exc())