()
| 165 | atexit.register(onexit) |
| 166 | |
| 167 | def mavlink_thread_out(): |
| 168 | # Huge try catch in case we see http://bugs.python.org/issue1856 |
| 169 | try: |
| 170 | while self._alive: |
| 171 | try: |
| 172 | msg = self.out_queue.get(True, timeout=0.01) |
| 173 | self.master.write(msg) |
| 174 | except Empty: |
| 175 | continue |
| 176 | except socket.error as error: |
| 177 | # If connection reset (closed), stop polling. |
| 178 | if error.errno == ECONNABORTED: |
| 179 | raise APIException('Connection aborting during read') |
| 180 | raise |
| 181 | except Exception as e: |
| 182 | errprinter('>>> mav send error:', e) |
| 183 | break |
| 184 | except APIException as e: |
| 185 | errprinter('>>> ' + str(e.message)) |
| 186 | self._alive = False |
| 187 | self.master.close() |
| 188 | self._death_error = e |
| 189 | |
| 190 | except Exception as e: |
| 191 | # http://bugs.python.org/issue1856 |
| 192 | if not self._alive: |
| 193 | pass |
| 194 | else: |
| 195 | self._alive = False |
| 196 | self.master.close() |
| 197 | self._death_error = e |
| 198 | |
| 199 | # Explicitly clear out buffer so .close closes. |
| 200 | self.out_queue = Queue() |
| 201 | |
| 202 | def mavlink_thread_in(): |
| 203 | # Huge try catch in case we see http://bugs.python.org/issue1856 |
nothing calls this directly
no test coverage detected