예제 #1
0
 def connection_made(self, transport: asyncio.Transport):
     self._transport = transport
     self.peername = self._transport.get_extra_info("peername")
     transport.write(self.local._connect_buffer)
     self.ready = True
     CONNECTION_MADE_COUNT.inc()
     ACTIVE_CONNECTION_COUNT.inc()
예제 #2
0
 def connection_made(self, transport):
     self._transport = transport
     peername = self._transport.get_extra_info("peername")
     self._handler.handle_connection_made(flag.TRANSPORT_TCP, transport,
                                          peername)
     CONNECTION_MADE_COUNT.inc()
     ACTIVE_CONNECTION_COUNT.inc()
예제 #3
0
    def close(self):
        if self._is_closing:
            return
        self._is_closing = True
        ACTIVE_CONNECTION_COUNT.inc(-1)

        self._transport and self._transport.close()
        self.local.close()
예제 #4
0
    def handle_connection_made(self, transport_type, transport, peername):
        self._init_transport(transport, peername, transport_type)
        if transport_type == flag.TRANSPORT_TCP and self.server.limited:
            self.server.log_limited_msg()
            self.close()
        self._init_cryptor()

        CONNECTION_MADE_COUNT.inc()
        ACTIVE_CONNECTION_COUNT.inc()
예제 #5
0
    def close(self):
        self._stage = self.STAGE_DESTROY
        if self._is_closing:
            return
        self._is_closing = True
        ACTIVE_CONNECTION_COUNT.inc(-1)

        if self._transport_protocol == flag.TRANSPORT_TCP:
            self._transport and self._transport.close()
            self.cipher and self.cipher.incr_user_tcp_num(-1)
        self._remote and self._remote.close()
예제 #6
0
    def close(self):
        if self._is_closing:
            return
        self._is_closing = True
        if self._transport_protocol == flag.TRANSPORT_TCP:
            self.server.incr_tcp_conn_num(-1)
            self._transport and self._transport.close()
            if self._remote:
                self._remote.close()
                # NOTE for circular reference
                self._remote = None
        elif self._transport_protocol == flag.TRANSPORT_UDP:
            pass
        else:
            raise NotImplementedError
        self._stage = self.STAGE_DESTROY

        ACTIVE_CONNECTION_COUNT.dec()
예제 #7
0
 def handle_connection_made(self, transport_protocol, transport, peername):
     self._init_transport(transport, peername, transport_protocol)
     self._init_cipher()
     ACTIVE_CONNECTION_COUNT.inc()
     CONNECTION_MADE_COUNT.inc()