Пример #1
0
 def close(self) -> None:
     self.server.remove_inactivity_timeout(self)
     self.server.request_out(self.request_parser, self.sock, self.address,
                             self.bytes_sent, self.connect_time,
                             self.status)
     self.server.loop.unregister(self)
     BaseIOEventHandler.close(self)
Пример #2
0
 def __init__(self, server: "TCPServer") -> None:
     BaseIOEventHandler.__init__(self)
     self.server = server
     self.timer = self.sock = TimerFD(clockid=CLOCK_REALTIME)
     # A timestamp -> {handlers: callbacks} dict
     self.timeouts: dict[float, dict[Any, Callable[..., None]]] = {}
     # A handler -> timestamp dict
     self.handlers_timeouts: dict[Any, float] = {}
Пример #3
0
 def __init__(self, server):
     BaseIOEventHandler.__init__(self)
     self.server = server
     self.timer = self.sock = TimerFD(clockid = CLOCK_REALTIME)
     # A timestamp -> {handlers: callbacks} dict
     self.timeouts = {}
     # A handler -> timestamp dict
     self.handlers_timeouts = {}
Пример #4
0
    def __init__(self, server, sock, address, request_parser, response):
        BaseIOEventHandler.__init__(self, server.evloop, sock)
        self.server = server
        self.address = address
        self.request_parser = request_parser

        self.output_buffer = buffer_event.BufferOutputHandler(sock)
        self.output_buffer.add_buffer(response.as_bytes())

        # statistics
        self.status = response.status
        self.connect_time = server.evloop.now()
        self.bytes_sent = 0
Пример #5
0
 def stop(self):
     self.server.request_out(self.request_parser, self.sock, self.address, self.bytes_sent,
                             self.connect_time, self.status)
     BaseIOEventHandler.stop(self)
     self.decref()
Пример #6
0
 def close(self):
     self.server.remove_inactivity_timeout(self)
     self.server.request_out(self.request_parser, self.sock, self.address, self.bytes_sent,
                             self.connect_time, self.status)
     self.server.loop.unregister(self)
     BaseIOEventHandler.close(self)
Пример #7
0
 def fired_timeout(self, handler: BaseIOEventHandler) -> None:
     self.server.logger.error("Timeout for %s: %d seconds without I/O" %
                              (handler, self.server.INACTIVITY_TIMEOUT))
     handler.close()