def sendBox(self, box):
"""
Send a amp.Box to my peer.
Note: transport.write is never called outside of this method.
@param box: an AmpBox.
@raise ProtocolSwitched: if the protocol has previously been switched.
@raise ConnectionLost: if the connection has previously been lost.
"""
if self._locked:
raise ProtocolSwitched(
"This connection has switched: no AMP traffic allowed.")
if self.transport is None:
raise ConnectionLost()
if self._startingTLSBuffer is not None:
self._startingTLSBuffer.append(box)
else:
self.transport.write(box.serialize())
评论列表
文章目录