iostream.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:noc-orchestrator 作者: DirceuSilvaLabs 项目源码 文件源码
def wait_for_handshake(self, callback=None):
        """Wait for the initial SSL handshake to complete.

        If a ``callback`` is given, it will be called with no
        arguments once the handshake is complete; otherwise this
        method returns a `.Future` which will resolve to the
        stream itself after the handshake is complete.

        Once the handshake is complete, information such as
        the peer's certificate and NPN/ALPN selections may be
        accessed on ``self.socket``.

        This method is intended for use on server-side streams
        or after using `IOStream.start_tls`; it should not be used
        with `IOStream.connect` (which already waits for the
        handshake to complete). It may only be called once per stream.

        .. versionadded:: 4.2
        """
        if (self._ssl_connect_callback is not None or
                self._ssl_connect_future is not None):
            raise RuntimeError("Already waiting")
        if callback is not None:
            self._ssl_connect_callback = stack_context.wrap(callback)
            future = None
        else:
            future = self._ssl_connect_future = TracebackFuture()
        if not self._ssl_accepting:
            self._run_ssl_connect_callback()
        return future
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号