Пример #1
0
 def gevent_check_read(self, ):
     if gselect([self], (), (), 0)[0]:
         # gselect inserts a call to gevent.sleep() to spin
         # the event loop. If we don't do that, then one connection
         # can monopolize the event loop.
         return True
     return False
Пример #2
0
    def _reader_loop(self):
        while True:
            rlist, _, _ = gselect([self.socket], [], [])

            if self.socket in rlist:
                data = self._read_data()

                if not data:
                    logger.debug("Connection error (reader).")
                    self.disconnect()
                    return

                self._readbuf += data
                self._read_packets()
Пример #3
0
    def _reader_loop(self):
        while True:
            rlist, _, _ = gselect([self.socket], [], [])

            if self.socket in rlist:
                data = self._read_data()

                if not data:
                    logger.debug("Connection error (reader).")
                    self.disconnect()
                    return

                self._readbuf += data
                self._read_packets()
Пример #4
0
 def _select(self, rlist, wlist, xlist, timeout=None):
     return gselect(rlist, wlist, xlist, timeout=timeout)
Пример #5
0
 def _select(self, rlist, wlist, xlist, timeout=None):
     return gselect(rlist, wlist, xlist, timeout=timeout)
Пример #6
0
 def gevent_check_write(self):
     if gselect((), [self], (), 0)[1]:
         return True
     return False