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


Python GreenSocket.gettimeout方法代码示例

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


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

示例1: __init__

# 需要导入模块: from eventlet.greenio import GreenSocket [as 别名]
# 或者: from eventlet.greenio.GreenSocket import gettimeout [as 别名]
    def __init__(
        self,
        sock,
        keyfile=None,
        certfile=None,
        server_side=False,
        cert_reqs=CERT_NONE,
        ssl_version=PROTOCOL_SSLv23,
        ca_certs=None,
        do_handshake_on_connect=True,
        *args,
        **kw
    ):
        if not isinstance(sock, GreenSocket):
            sock = GreenSocket(sock)

        self.act_non_blocking = sock.act_non_blocking

        if six.PY2:
            # On Python 2 SSLSocket constructor queries the timeout, it'd break without
            # this assignment
            self._timeout = sock.gettimeout()

        # nonblocking socket handshaking on connect got disabled so let's pretend it's disabled
        # even when it's on
        super(GreenSSLSocket, self).__init__(
            sock.fd,
            keyfile,
            certfile,
            server_side,
            cert_reqs,
            ssl_version,
            ca_certs,
            do_handshake_on_connect and six.PY2,
            *args,
            **kw
        )

        # the superclass initializer trashes the methods so we remove
        # the local-object versions of them and let the actual class
        # methods shine through
        # Note: This for Python 2
        try:
            for fn in orig_socket._delegate_methods:
                delattr(self, fn)
        except AttributeError:
            pass

        if six.PY3:
            # Python 3 SSLSocket construction process overwrites the timeout so restore it
            self._timeout = sock.gettimeout()

            # it also sets timeout to None internally apparently (tested with 3.4.2)
            _original_sslsocket.settimeout(self, 0.0)
            assert _original_sslsocket.gettimeout(self) == 0.0

            # see note above about handshaking
            self.do_handshake_on_connect = do_handshake_on_connect
            if do_handshake_on_connect and self._connected:
                self.do_handshake()
开发者ID:simudream,项目名称:eventlet,代码行数:62,代码来源:ssl.py

示例2: __init__

# 需要导入模块: from eventlet.greenio import GreenSocket [as 别名]
# 或者: from eventlet.greenio.GreenSocket import gettimeout [as 别名]
    def __init__(self, sock, *args, **kw):
        if not isinstance(sock, GreenSocket):
            sock = GreenSocket(sock)

        self.act_non_blocking = sock.act_non_blocking
        self._timeout = sock.gettimeout()
        super(GreenSSLSocket, self).__init__(sock.fd, *args, **kw)
       
        # the superclass initializer trashes the methods so... 
        for fn in orig_socket._delegate_methods:
            delattr(self, fn)
开发者ID:JeremyGrosser,项目名称:python-eventlet,代码行数:13,代码来源:ssl.py

示例3: __init__

# 需要导入模块: from eventlet.greenio import GreenSocket [as 别名]
# 或者: from eventlet.greenio.GreenSocket import gettimeout [as 别名]
    def __init__(self, sock, *args, **kw):
        if not isinstance(sock, GreenSocket):
            sock = GreenSocket(sock)

        self.act_non_blocking = sock.act_non_blocking
        self._timeout = sock.gettimeout()
        super(GreenSSLSocket, self).__init__(sock.fd, *args, **kw)
       
        # the superclass initializer trashes the methods so we remove
        # the local-object versions of them and let the actual class
        # methods shine through
        try:
            for fn in orig_socket._delegate_methods:
                delattr(self, fn)
        except AttributeError:
            pass
开发者ID:simplegeo,项目名称:eventlet,代码行数:18,代码来源:ssl.py


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