Commit afe4a7f
fix: catch BaseException in connect() to clean up on CancelledError
The `except Exception:` handler in connect() did not catch
CancelledError (a BaseException since Python 3.9). If a task was
cancelled during handshake() or open_database(), the protocol's
close() was never called, leaking the TCP socket. The connection
also appeared as "connected" despite being half-initialized.
Change to `except BaseException:` so cancellation properly closes
the transport and resets the protocol to None.
Closes #083
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent b87f3e0 commit afe4a7f
2 files changed
Lines changed: 40 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
496 | 535 | | |
497 | 536 | | |
498 | 537 | | |
| |||
0 commit comments