def sock_poll(self, timeout): with self.downstream_lock: to_close = None to_read = None while not (to_close or to_read or self.closed): try: to_read, _, to_close = select([self.sock], [], [self.sock], timeout) except select_error as r: if not r.args[0] == errno.EINTR: to_close = True continue break if to_close: raise EOFError('sock_poll error') if to_read: self._read() self.transport.downstream_recv(self.buf_in) return True else: return False
def poll(self, timeout): """indicates whether the stream has data to read (within *timeout* seconds)""" try: rl, _, _ = select([self], [], [], timeout) except ValueError: # i got this once: "ValueError: file descriptor cannot be a negative integer (-1)" # let's translate it to select.error ex = sys.exc_info()[1] raise select_error(str(ex)) return bool(rl)
def poll(self, timeout): """indicates whether the stream has data to read (within *timeout* seconds)""" try: rl, _, _ = select([self], [], [], timeout) except ValueError: # i get this some times: "ValueError: file descriptor cannot be a negative integer (-1)" # let's translate it to select.error ex = sys.exc_info()[1] raise select_error(str(ex)) return bool(rl)
def sock_poll(self, timeout): with self.downstream_lock: to_read, _, to_close = select([self.sock], [], [self.sock], timeout) if to_close: raise EOFError('sock_poll error') if to_read: self._read() self.transport.downstream_recv(self.buf_in) return True else: return False
def poll(self, timeout): """indicates whether the stream has data to read (within *timeout* seconds)""" try: while True: try: rl, _, _ = select([self], [], [], timeout) except select_error as ex: if ex[0] == errno.EINTR: continue else: raise else: break except ValueError as ex: # i get this some times: "ValueError: file descriptor cannot be a negative integer (-1)" # let's translate it to select.error raise select_error(str(ex)) return bool(rl)
def poll(self, timeout): """indicate whether the stream has data to read""" rl, _, _ = select([self], [], [], timeout) return bool(rl)
def poll(self, timeout): """indicates whether the stream has data to read (within *timeout* seconds)""" rl, _, _ = select([self], [], [], timeout) return bool(rl)