本文整理汇总了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()
示例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()
示例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)
示例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()
示例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)