當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。