Commit 4e56d93
fix: register link + stateTask atomically in openLink
The link registration and its stateUpdates drain task were stored in two
separate linkLock sections split by an await. A stop() racing that window
cleared linkStateTasks (not yet holding the new task) and links, then
openLink re-inserted the task into the emptied map — orphaning it (link
actor kept alive, stale events into the next session, linkId absent from
links so linkTeardown couldn't reach it). Build the Task and store both
writes inside one critical section; the constructor is synchronous so it's
lock-safe, and setPacketCallback's await now follows the unlock.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 99e04e6 commit 4e56d93
1 file changed
Lines changed: 18 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
456 | | - | |
457 | | - | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
458 | 466 | | |
459 | 467 | | |
460 | 468 | | |
461 | 469 | | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
| 470 | + | |
472 | 471 | | |
473 | 472 | | |
474 | 473 | | |
475 | 474 | | |
476 | 475 | | |
477 | | - | |
478 | | - | |
479 | 476 | | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
480 | 484 | | |
481 | 485 | | |
482 | 486 | | |
| |||
0 commit comments