(self)
| 364 | self.connection.server = None |
| 365 | |
| 366 | def disconnect(self): |
| 367 | if self.connection.process_replaced: |
| 368 | # Wait for the replacement server to connect to the adapter, and to report |
| 369 | # itself to the client for this session if there is one. |
| 370 | log.info("{0} is waiting for replacement subprocess.", self) |
| 371 | session = self.session |
| 372 | if not session.client or not session.client.is_connected: |
| 373 | wait_for_connection( |
| 374 | session, lambda conn: conn.pid == self.pid, timeout=60 |
| 375 | ) |
| 376 | else: |
| 377 | self.wait_for( |
| 378 | lambda: ( |
| 379 | not session.client |
| 380 | or not session.client.is_connected |
| 381 | or any( |
| 382 | conn.pid == self.pid |
| 383 | for conn in session.client.known_subprocesses |
| 384 | ) |
| 385 | ), |
| 386 | timeout=60, |
| 387 | ) |
| 388 | with _lock: |
| 389 | _connections.remove(self.connection) |
| 390 | _connections_changed.set() |
| 391 | super().disconnect() |
| 392 | |
| 393 | |
| 394 | def serve(host="127.0.0.1", port=0): |
no test coverage detected