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


Python ProtocolWrapper.makeConnection方法代码示例

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


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

示例1: makeConnection

# 需要导入模块: from twisted.protocols.policies import ProtocolWrapper [as 别名]
# 或者: from twisted.protocols.policies.ProtocolWrapper import makeConnection [as 别名]
    def makeConnection(self, transport):
        """
        Connect this wrapper to the given transport and initialize the
        necessary L{OpenSSL.SSL.Connection} with a memory BIO.
        """
        self._tlsConnection = self.factory._createConnection(self)
        self._appSendBuffer = []

        # Add interfaces provided by the transport we are wrapping:
        for interface in providedBy(transport):
            directlyProvides(self, interface)

        # Intentionally skip ProtocolWrapper.makeConnection - it might call
        # wrappedProtocol.makeConnection, which we want to make conditional.
        Protocol.makeConnection(self, transport)
        self.factory.registerProtocol(self)
        if self._connectWrapped:
            # Now that the TLS layer is initialized, notify the application of
            # the connection.
            ProtocolWrapper.makeConnection(self, transport)

        # Now that we ourselves have a transport (initialized by the
        # ProtocolWrapper.makeConnection call above), kick off the TLS
        # handshake.
        self._checkHandshakeStatus()
开发者ID:esabelhaus,项目名称:secret-octo-dubstep,代码行数:27,代码来源:tls.py

示例2: makeConnection

# 需要导入模块: from twisted.protocols.policies import ProtocolWrapper [as 别名]
# 或者: from twisted.protocols.policies.ProtocolWrapper import makeConnection [as 别名]
    def makeConnection(self, transport):
        """
        Connect this wrapper to the given transport and initialize the
        necessary L{OpenSSL.SSL.Connection} with a memory BIO.
        """
        tlsContext = self.factory._contextFactory.getContext()
        self._tlsConnection = Connection(tlsContext, None)
        if self.factory._isClient:
            self._tlsConnection.set_connect_state()
        else:
            self._tlsConnection.set_accept_state()
        self._appSendBuffer = []

        # Intentionally skip ProtocolWrapper.makeConnection - it might call
        # wrappedProtocol.makeConnection, which we want to make conditional.
        Protocol.makeConnection(self, transport)
        self.factory.registerProtocol(self)
        if self._connectWrapped:
            # Now that the TLS layer is initialized, notify the application of
            # the connection.
            ProtocolWrapper.makeConnection(self, transport)

        # Now that we ourselves have a transport (initialized by the
        # ProtocolWrapper.makeConnection call above), kick off the TLS
        # handshake.
        try:
            self._tlsConnection.do_handshake()
        except WantReadError:
            # This is the expected case - there's no data in the connection's
            # input buffer yet, so it won't be able to complete the whole
            # handshake now.  If this is the speak-first side of the
            # connection, then some bytes will be in the send buffer now; flush
            # them.
            self._flushSendBIO()
开发者ID:BillAndersan,项目名称:twisted,代码行数:36,代码来源:tls.py

示例3: makeConnection

# 需要导入模块: from twisted.protocols.policies import ProtocolWrapper [as 别名]
# 或者: from twisted.protocols.policies.ProtocolWrapper import makeConnection [as 别名]
 def makeConnection(self, transport):
     """
     Fire the Deferred at C{self.factory.connectionNotification} with the
     real protocol.
     """
     ProtocolWrapper.makeConnection(self, transport)
     self.factory.connectionNotification.callback(self.wrappedProtocol)
开发者ID:eriknelson,项目名称:gam3,代码行数:9,代码来源:ui.py

示例4: makeConnection

# 需要导入模块: from twisted.protocols.policies import ProtocolWrapper [as 别名]
# 或者: from twisted.protocols.policies.ProtocolWrapper import makeConnection [as 别名]
    def makeConnection(self, transport):
        """
        Connect this wrapper to the given transport and initialize the
        necessary L{OpenSSL.SSL.Connection} with a memory BIO.
        """
        self._tlsConnection = self.factory._createConnection(self)
        self._appSendBuffer = []

        # Add interfaces provided by the transport we are wrapping:
        for interface in providedBy(transport):
            directlyProvides(self, interface)

        # Intentionally skip ProtocolWrapper.makeConnection - it might call
        # wrappedProtocol.makeConnection, which we want to make conditional.
        Protocol.makeConnection(self, transport)
        self.factory.registerProtocol(self)
        if self._connectWrapped:
            # Now that the TLS layer is initialized, notify the application of
            # the connection.
            ProtocolWrapper.makeConnection(self, transport)

        # Now that we ourselves have a transport (initialized by the
        # ProtocolWrapper.makeConnection call above), kick off the TLS
        # handshake.

        # The connection might already be aborted (eg. by a callback during
        # connection setup), so don't even bother trying to handshake in that
        # case.
        if not self._aborted:
            try:
                self._tlsConnection.do_handshake()
            except WantReadError:
                # This is the expected case - there's no data in the
                # connection's input buffer yet, so it won't be able to
                # complete the whole handshake now. If this is the speak-first
                # side of the connection, then some bytes will be in the send
                # buffer now; flush them.
                self._flushSendBIO()
开发者ID:Architektor,项目名称:PySnip,代码行数:40,代码来源:tls.py

示例5: makeConnection

# 需要导入模块: from twisted.protocols.policies import ProtocolWrapper [as 别名]
# 或者: from twisted.protocols.policies.ProtocolWrapper import makeConnection [as 别名]
 def makeConnection(self, transport):
     if debug:
         print 'TwistedProtocolWrapper.makeConnection'
     ProtocolWrapper.makeConnection(self, transport)
开发者ID:mikedougherty,项目名称:M2Crypto,代码行数:6,代码来源:TwistedProtocolWrapper.py


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