Python源码示例:asyncio.BaseTransport()

示例1
def __init__(
        self,
        host: str,
        username: str,
        password: str,
        heartbeat: int = 60,
        virtual_host: str = "/",
        loop: asyncio.AbstractEventLoop = None,
        on_error: OnErrorCallback = None,
    ) -> None:
        self.host = host
        self.username = username
        self.password = password
        self.virtual_host = virtual_host
        self.heartbeat = heartbeat
        self.loop = loop
        self._on_error = on_error

        self._connection_lock = asyncio.Lock()

        self.channel: Channel = None
        self._transport: Optional[asyncio.BaseTransport] = None
        self._protocol: AmqpProtocol = None 
示例2
def connection_made(self, transport: asyncio.BaseTransport) -> None:
        # we need to cast here because the signature in the base class dicates BaseTransport
        # and arguments can only be redefined contravariantly
        self.transport = cast(asyncio.DatagramTransport, transport) 
示例3
def __init__(self, config: Config) -> None:
        super().__init__(config)
        self.address = config.statsd_host.rsplit(":", 1)
        self.transport: Optional[asyncio.BaseTransport] = None 
示例4
def connection_made(self, transport: BaseTransport) -> None:
        sock = transport.get_extra_info('socket')
        if sock is not None:
            _set_nodelay(sock)

        h2_conn = H2Connection(config=self.h2_config)
        h2_conn.initiate_connection()

        initial = h2_conn.local_settings.initial_window_size
        conn_delta = self.config.http2_connection_window_size - initial
        stream_delta = self.config.http2_stream_window_size - initial
        if conn_delta:
            h2_conn.increment_flow_control_window(conn_delta)
        if stream_delta:
            h2_conn.update_settings({
                SettingCodes.INITIAL_WINDOW_SIZE:
                    self.config.http2_stream_window_size,
            })

        self.connection = Connection(
            h2_conn,
            cast(Transport, transport),
            config=self.config,
        )
        self.connection.flush()
        self.connection.initialize()

        self.processor = EventsProcessor(self.handler, self.connection) 
示例5
def connection_made(self, transport: asyncio.BaseTransport) -> None:
        if MYPY:
            assert isinstance(transport, asyncio.WriteTransport)
        self.transport = transport 
示例6
def connection_made(self, transport: asyncio.BaseTransport) -> None:
        self.transport = cast(asyncio.Transport, transport)
        self._over_ssl = transport.get_extra_info("sslcontext") is not None
        self._response_waiter = self._loop.create_future()
        self._command_lock = asyncio.Lock()

        if self._connection_lost_callback is not None:
            self._connection_lost_waiter = self._loop.create_future()
            self._connection_lost_waiter.add_done_callback(
                self._connection_lost_callback
            ) 
示例7
def connection_made(self, transport: asyncio.BaseTransport) -> None:
        super().connection_made(transport)

        real_transport = cast(asyncio.Transport, transport)
        if self._tcp_keepalive:
            tcp_keepalive(real_transport)

        self._task_handler = self._loop.create_task(self.start())
        assert self._manager is not None
        self._manager.connection_made(self, real_transport) 
示例8
def connection_made(self, transport: asyncio.BaseTransport) -> None:
        tr = cast(asyncio.Transport, transport)
        tcp_nodelay(tr, True)
        self.transport = tr 
示例9
def connection_made(self, transport: asyncio.BaseTransport):
        """
        When the TCP handshake is completed, notify the observer.
        """
        self.transport = transport
        self.connectedEvent.set()
        self.observer.onConnection() 
示例10
def connection_made(self, transport: asyncio.BaseTransport):
        """Method from base class, called when connection is established"""
        self.transport = transport 
示例11
def __init__(self,
                 reader: asyncio.StreamReader,
                 extra: Dict[str, Any] = None) -> None:
        self._is_closing = False
        self._reader = reader
        super().__init__(extra)

    #
    # BaseTransport methods
    #
    # methods we don't overwrite because they already raise NotImplementedError
    # and we don't need them
    # - set_protocol
    # - get_protocol