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
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()
def _select(self, rlist, wlist, xlist, timeout=None): return gselect(rlist, wlist, xlist, timeout=timeout)
def gevent_check_write(self): if gselect((), [self], (), 0)[1]: return True return False