Esempio n. 1
0
 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()
Esempio n. 2
0
 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()
Esempio n. 3
0
 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))
Esempio n. 5
0
 def writeConnectionLost(self):
     if IHalfCloseableProtocol.providedBy(self.proto):
         self.proto.writeConnectionLost()
     self.checkConnLost()
Esempio n. 6
0
 def writeConnectionLost(self):
     if IHalfCloseableProtocol.providedBy(self.proto):
         self.proto.writeConnectionLost()
     self.checkConnLost()
Esempio n. 7
0
 def loseWriteConnection(self):
     if not IHalfCloseableProtocol.providedBy(self._protocol):
         # this is a clear error
         raise HalfCloseUsedOnNonHalfCloseable()
     self.local_close()
Esempio n. 8
0
 def signal_writeConnectionLost(self):
     IHalfCloseableProtocol(self._protocol).writeConnectionLost()
Esempio n. 9
0
 def signal_readConnectionLost(self):
     IHalfCloseableProtocol(self._protocol).readConnectionLost()