Commit ef36032
authored
fix: ensure
This fixes flaky failures in some of the integration tests coming soon. When a peer disconnects and the write path (broken pipe) detects it before the read path (EOF), the `PeerDisconnected` event could be lost entirely. `receive_message()` returned
`ConnectionFailed` instead of `PeerDisconnected`, causing the reader loop to hit the catch-all error handler which slept 1 second before cleanup. During that sleep, the maintenance
loop could silently remove the peer from the pool, preventing the event from ever being emitted.
- Return `PeerDisconnected` from `receive_message()` when connection state is already cleared
- Remove unnecessary 1-second sleep in the reader loop error handlerPeerDisconnected is emitted on write-path disconnects (#435)1 parent 2a2b141 commit ef36032
2 files changed
+3
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
656 | 656 | | |
657 | 657 | | |
658 | 658 | | |
659 | | - | |
660 | | - | |
661 | 659 | | |
662 | 660 | | |
663 | 661 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
376 | 374 | | |
377 | 375 | | |
378 | 376 | | |
| |||
0 commit comments