class PystolServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer): def __init__(self, server_address, handler_class=RequestHandler): self.watcher = Watcher(MasterIndex()) SocketServer.TCPServer.__init__(self, server_address, handler_class) def run(self, daemon=False): ''' @summary: run server @param daemon: bool ''' self.watcher.start() logger.debug("start watch server.") if daemon: Process(target=self.serve_forever).start() else: self.serve_forever() def stop(self): ''' @summary: サーバーの停止メソッドです @todo: 終了処理を行う ''' self.shutdown()
def __init__(self, server_address, handler_class=RequestHandler): self.watcher = Watcher(MasterIndex()) SocketServer.TCPServer.__init__(self, server_address, handler_class)