def controller(self, handler): while 1: try: data, route = handler.sock.recv() handler.handle(data, route) except Exception as e: if not is_socket_related_error(e): self.print_trace(handler.sock) self.attempt_graceful_close(handler, handler.sock) _thread.exit()
def start(self): self.sync.start() while 1 and self.connected: data = self.sock.recv() try: if data[1] in self.routes: self.routes[data[1]].run(data[0], self) except Exception as e: if not is_socket_related_error(e): capture_trace() break