Commit 1e09248
ClashFX Team
fix: add 10s traffic watchdog to recover from half-dead websocket
Starscream 3.1.1 does not auto-ping, and macOS TCP keep-alive only
fires after ~2 hours. A half-dead connection (NAT timeout, mihomo
deadlock, carrier RST without TCP FIN) never raises a disconnect
callback, so the speed indicator silently freezes on the last
received values even with retry logic in place.
Arm a 10s one-shot timer on every traffic message and on every
successful traffic connect; if the timer fires it means no data has
arrived in 10s and we force resetTrafficStreamApi(), which tears
down the zombie socket and reconnects. Cancel the timer when
entering direct-API mode (no websocket in use).1 parent a7ff626 commit 1e09248
1 file changed
Lines changed: 35 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
73 | 74 | | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| |||
516 | 518 | | |
517 | 519 | | |
518 | 520 | | |
| 521 | + | |
519 | 522 | | |
520 | 523 | | |
521 | 524 | | |
| |||
559 | 562 | | |
560 | 563 | | |
561 | 564 | | |
| 565 | + | |
562 | 566 | | |
563 | 567 | | |
564 | 568 | | |
| |||
607 | 611 | | |
608 | 612 | | |
609 | 613 | | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
610 | 644 | | |
611 | 645 | | |
612 | 646 | | |
613 | 647 | | |
| 648 | + | |
614 | 649 | | |
615 | 650 | | |
616 | 651 | | |
| |||
0 commit comments