Пример #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 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("-")
Пример #3
0
 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("+")
Пример #4
0
 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("+")
Пример #5
0
    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!
Пример #6
0
    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!
Пример #7
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!
Пример #8
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!