def process_request(self, request, client_address): timer.timeout_add( 0, self.process_request_thread, request, client_address, )
def run(): if os.path.exists(share.LOCK_PATH): lock.remove_file(share.LOCK_PATH) log.msg("check lock...") for i in xrange(5): time.sleep(0.5) if os.path.exists(share.LOCK_PATH): log.err("lock exist, exit") lock.create_file(share.RESTORE_PATH) os._exit(1) timer.timeout_add(500, lock.check_lock) share.MAIN_WINDOW.show() gtk.main()
def start_http_server(): log.msg("Start player server on (127.0.0.1:%d)"%share.PORT) server = HTTPServer(("127.0.0.1", share.PORT), HTTPHandler) server.timeout = 0 timer.timeout_add(share.HTTP_HANDLE_INTERVAL, http_server, server)