def removeConnectedChannel(self, channel): """ Remove the connected channel, and report the current number of open channels to the listening socket in the parent process. """ HTTPFactory.removeConnectedChannel(self, channel) self._report("-")
def addConnectedChannel(self, channel): """ Add the connected channel, and report the current number of open channels to the listening socket in the parent process. """ HTTPFactory.addConnectedChannel(self, channel) self._report("+")
def testAllConnectionsClosedWithoutConnectedChannels(self): """ allConnectionsClosed( ) should fire right away if no connected channels """ self.callbackFired = False factory = HTTPFactory(None) factory.allConnectionsClosed().addCallback(self._callback) self.assertTrue(self.callbackFired) # now!
def testallConnectionsClosedWithConnectedChannels(self): """ allConnectionsClosed( ) should only fire after all connected channels have been removed """ self.callbackFired = False factory = HTTPFactory(None) factory.addConnectedChannel("A") factory.addConnectedChannel("B") factory.addConnectedChannel("C") factory.allConnectionsClosed().addCallback(self._callback) factory.removeConnectedChannel("A") self.assertFalse(self.callbackFired) # wait for it... factory.removeConnectedChannel("B") self.assertFalse(self.callbackFired) # wait for it... factory.removeConnectedChannel("C") self.assertTrue(self.callbackFired) # now!