Exemple #1
0
    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
Exemple #2
0
 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)
Exemple #3
0
 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)
Exemple #4
0
    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 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
Exemple #6
0
 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)
Exemple #7
0
 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)
Exemple #8
0
 def poll(self, timeout):
     """indicate whether the stream has data to read"""
     rl, _, _ = select([self], [], [], timeout)
     return bool(rl)
Exemple #9
0
 def poll(self, timeout):
     """indicates whether the stream has data to read (within *timeout* 
     seconds)"""
     rl, _, _ = select([self], [], [], timeout)
     return bool(rl)
Exemple #10
0
 def poll(self, timeout):
     """indicate whether the stream has data to read"""
     rl, _, _ = select([self], [], [], timeout)
     return bool(rl)
Exemple #11
0
 def poll(self, timeout):
     """indicates whether the stream has data to read (within *timeout* 
     seconds)"""
     rl, _, _ = select([self], [], [], timeout)
     return bool(rl)