示例#1
0
文件: server.py 项目: bluele/pystol
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()
示例#2
0
文件: server.py 项目: bluele/pystol
 def __init__(self, server_address, handler_class=RequestHandler):
     self.watcher = Watcher(MasterIndex())
     SocketServer.TCPServer.__init__(self, server_address, handler_class)