예제 #1
0
 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("-")
예제 #2
0
    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!