Commit 32affcd
fix(ble): silence noble disconnect-race rejections during unsubscribe (#3670)
When the BLE peripheral disconnects while a C2 unsubscribe (or final
disconnect) call is in flight, noble rejects the pending operation with
"Disconnected <N>". The previous code logged this as a real error even
though it is the expected outcome of a normal disconnect race and the
unsubscribe is moot once the link is gone.
- Handshake-timeout path now skips the unsubscribe entirely when the
peripheral is no longer connected, and treats noble disconnect errors
as silent.
- BTP-close-callback unsubscribe and the close() disconnect catch use
the same isNobleDisconnectError filter so genuine errors still surface
while race-rejections do not.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 0187601 commit 32affcd
1 file changed
Lines changed: 17 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
505 | | - | |
506 | | - | |
507 | | - | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
508 | 512 | | |
509 | 513 | | |
510 | 514 | | |
| |||
560 | 564 | | |
561 | 565 | | |
562 | 566 | | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | 567 | | |
567 | 568 | | |
568 | | - | |
569 | | - | |
570 | | - | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
571 | 574 | | |
572 | 575 | | |
573 | 576 | | |
| |||
663 | 666 | | |
664 | 667 | | |
665 | 668 | | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
671 | 674 | | |
672 | 675 | | |
673 | 676 | | |
| |||
0 commit comments