def loseConnection(self): # TODO: what happens if an IHalfCloseableProtocol calls normal # loseConnection()? I think we need to close the read side too. if IHalfCloseableProtocol.providedBy(self._protocol): # I don't know is correct, so avoid this for now raise NormalCloseUsedOnHalfCloseable() self.local_close()
def _set_protocol(self, protocol): assert not self._protocol self._protocol = protocol if IHalfCloseableProtocol.providedBy(protocol): self.connect_protocol_half() else: # move from UNCONNECTED to OPEN self.connect_protocol_full()
def test_interfacesForTransport(self): """ If the protocol objects returned by the factory given to L{ClientService} provide special "marker" interfaces for their transport - L{IHalfCloseableProtocol} or L{IFileDescriptorReceiver} - those interfaces will be provided by the protocol objects passed on to the reactor. """ @implementer(IHalfCloseableProtocol, IFileDescriptorReceiver) class FancyProtocol(Protocol, object): """ Provider of various interfaces. """ cq, service = self.makeReconnector(protocolType=FancyProtocol) reactorFacing = cq.constructedProtocols[0] self.assertTrue(IFileDescriptorReceiver.providedBy(reactorFacing)) self.assertTrue(IHalfCloseableProtocol.providedBy(reactorFacing))
def test_interfacesForTransport(self): """ If the protocol objects returned by the factory given to L{ClientService} provide special "marker" interfaces for their transport - L{IHalfCloseableProtocol} or L{IFileDescriptorReceiver} - those interfaces will be provided by the protocol objects passed on to the reactor. """ @implementer(IHalfCloseableProtocol, IFileDescriptorReceiver) class FancyProtocol(Protocol, object): """ Provider of various interfaces. """ cq, service = self.makeReconnector(protocolType=FancyProtocol) reactorFacing = cq.constructedProtocols[0] self.assertTrue(IFileDescriptorReceiver.providedBy(reactorFacing)) self.assertTrue(IHalfCloseableProtocol.providedBy(reactorFacing))
def writeConnectionLost(self): if IHalfCloseableProtocol.providedBy(self.proto): self.proto.writeConnectionLost() self.checkConnLost()
def writeConnectionLost(self): if IHalfCloseableProtocol.providedBy(self.proto): self.proto.writeConnectionLost() self.checkConnLost()
def loseWriteConnection(self): if not IHalfCloseableProtocol.providedBy(self._protocol): # this is a clear error raise HalfCloseUsedOnNonHalfCloseable() self.local_close()
def signal_writeConnectionLost(self): IHalfCloseableProtocol(self._protocol).writeConnectionLost()
def signal_readConnectionLost(self): IHalfCloseableProtocol(self._protocol).readConnectionLost()