コード例 #1
0
ファイル: server.py プロジェクト: gitter-badger/Pipe
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
コード例 #2
0
ファイル: server.py プロジェクト: gitter-badger/Pipe
 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())