Example #1
0
    def test_skips_registering(self):
        sock = greenhouse.Socket()
        poller = greenhouse.scheduler.state.poller

        poller.register(sock, poller.INMASK | poller.OUTMASK)

        items = poller._registry.items()

        poller.register(sock, poller.INMASK)

        self.assertEquals(poller._registry.items(), items)
Example #2
0
    def test_skips_registering(self):
        sock = greenhouse.Socket()
        poller = greenhouse.scheduler.state.poller

        poller.register(sock, poller.INMASK | poller.OUTMASK)

        items = poller._registry.items()

        poller.register(sock, poller.INMASK)

        self.assertEquals(poller._registry.items(), items)
Example #3
0
 def _wait_event(self, timeout=None, write=False):
     poller = scheduler.state.poller
     mask = poller.ERRMASK | (poller.OUTMASK if write else poller.INMASK)
     event = self._writable if write else self._readable
     try:
         counter = poller.register(self, mask)
     except EnvironmentError, error:
         if error.args[0] in errno.errorcode:
             raise socket.error(*error.args)
         raise
Example #4
0
    def test_register_both_read_and_write(self):
        with self.socketpair() as (client, handler):
            poller = greenhouse.scheduler.state.poller
            counter1 = poller.register(client, poller.INMASK)

            counter2 = poller.register(client, poller.OUTMASK)
Example #5
0
    def test_register_both_read_and_write(self):
        with self.socketpair() as (client, handler):
            poller = greenhouse.scheduler.state.poller
            counter1 = poller.register(client, poller.INMASK)

            counter2 = poller.register(client, poller.OUTMASK)