当前位置: 首页>>代码示例>>Python>>正文


Python asyncio.BaseTransport方法代码示例

本文整理汇总了Python中asyncio.BaseTransport方法的典型用法代码示例。如果您正苦于以下问题:Python asyncio.BaseTransport方法的具体用法?Python asyncio.BaseTransport怎么用?Python asyncio.BaseTransport使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在asyncio的用法示例。


在下文中一共展示了asyncio.BaseTransport方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import asyncio [as 别名]
# 或者: from asyncio import BaseTransport [as 别名]
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 
开发者ID:b2wdigital,项目名称:async-worker,代码行数:25,代码来源:connection.py

示例2: connection_made

# 需要导入模块: import asyncio [as 别名]
# 或者: from asyncio import BaseTransport [as 别名]
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) 
开发者ID:QuarkChain,项目名称:pyquarkchain,代码行数:6,代码来源:discovery.py

示例3: __init__

# 需要导入模块: import asyncio [as 别名]
# 或者: from asyncio import BaseTransport [as 别名]
def __init__(self, config: Config) -> None:
        super().__init__(config)
        self.address = config.statsd_host.rsplit(":", 1)
        self.transport: Optional[asyncio.BaseTransport] = None 
开发者ID:pgjones,项目名称:hypercorn,代码行数:6,代码来源:statsd.py

示例4: connection_made

# 需要导入模块: import asyncio [as 别名]
# 或者: from asyncio import BaseTransport [as 别名]
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) 
开发者ID:vmagamedov,项目名称:grpclib,代码行数:30,代码来源:protocol.py

示例5: connection_made

# 需要导入模块: import asyncio [as 别名]
# 或者: from asyncio import BaseTransport [as 别名]
def connection_made(self, transport: asyncio.BaseTransport) -> None:
        if MYPY:
            assert isinstance(transport, asyncio.WriteTransport)
        self.transport = transport 
开发者ID:numberoverzero,项目名称:bottom,代码行数:6,代码来源:protocol.py

示例6: connection_made

# 需要导入模块: import asyncio [as 别名]
# 或者: from asyncio import BaseTransport [as 别名]
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
            ) 
开发者ID:cole,项目名称:aiosmtplib,代码行数:13,代码来源:protocol.py

示例7: connection_made

# 需要导入模块: import asyncio [as 别名]
# 或者: from asyncio import BaseTransport [as 别名]
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) 
开发者ID:TouwaStar,项目名称:Galaxy_Plugin_Bethesda,代码行数:12,代码来源:web_protocol.py

示例8: connection_made

# 需要导入模块: import asyncio [as 别名]
# 或者: from asyncio import BaseTransport [as 别名]
def connection_made(self, transport: asyncio.BaseTransport) -> None:
        tr = cast(asyncio.Transport, transport)
        tcp_nodelay(tr, True)
        self.transport = tr 
开发者ID:TouwaStar,项目名称:Galaxy_Plugin_Bethesda,代码行数:6,代码来源:base_protocol.py

示例9: connection_made

# 需要导入模块: import asyncio [as 别名]
# 或者: from asyncio import BaseTransport [as 别名]
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() 
开发者ID:GoSecure,项目名称:pyrdp,代码行数:9,代码来源:tcp.py

示例10: connection_made

# 需要导入模块: import asyncio [as 别名]
# 或者: from asyncio import BaseTransport [as 别名]
def connection_made(self, transport: asyncio.BaseTransport):
        """Method from base class, called when connection is established"""
        self.transport = transport 
开发者ID:openlawlibrary,项目名称:pygls,代码行数:5,代码来源:protocol.py

示例11: __init__

# 需要导入模块: import asyncio [as 别名]
# 或者: from asyncio import BaseTransport [as 别名]
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 
开发者ID:ethereum,项目名称:trinity,代码行数:16,代码来源:asyncio_streams.py


注:本文中的asyncio.BaseTransport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。