(self, wait_trn_id, timeout)
| 117 | # Contributed by Jason Anderson |
| 118 | # |
| 119 | def _pollForQueryPacket(self, wait_trn_id, timeout): |
| 120 | end_time = time.time() - timeout |
| 121 | while True: |
| 122 | try: |
| 123 | _timeout = time.time()-end_time |
| 124 | if _timeout <= 0: |
| 125 | return None |
| 126 | |
| 127 | ready, _, _ = select.select([ self.sock.fileno() ], [ ], [ ], _timeout) |
| 128 | if not ready: |
| 129 | return None |
| 130 | |
| 131 | data, _ = self.sock.recvfrom(0xFFFF) |
| 132 | if len(data) == 0: |
| 133 | raise NotConnectedError |
| 134 | |
| 135 | trn_id, ret = self.decodeIPQueryPacket(data) |
| 136 | |
| 137 | if trn_id == wait_trn_id: |
| 138 | return ret |
| 139 | except select.error as ex: |
| 140 | if type(ex) is tuple: |
| 141 | if ex[0] != errno.EINTR and ex[0] != errno.EAGAIN: |
| 142 | raise ex |
| 143 | else: |
| 144 | raise ex |
no test coverage detected