Commit 14a8791
committed
client: happy eyeballs: retire the primary socket when a racer wins
When a racing (parallel) connect is seen to have completed in the
LCCCR_CONNECTED path, promote_parallel_fd() moves wsi->desc and
wsi->position_in_fds_table to the racer, but nothing removes the primary
socket from the fds table or closes it. Its slot keeps mapping the primary fd
to this wsi while the wsi's position_in_fds_table now points at the racer's
slot, so the slot can never be removed: __remove_wsi_socket_from_fds() on this
wsi will always target the racer's slot instead.
The observable effect is that pt->fds never drains, so the
while (pt->fds_count) {
struct lws *wsi = wsi_from_fd(context, pt->fds[0].fd);
...
}
loop in lws_context_destroy() spins forever at 100% CPU, and the primary
socket is leaked.
Retire the primary before promoting, the same way the conn_good is_parallel
path already does (remove from fds, then promote_parallel or close). Reached
easily with an event lib that implements the parallel ops: on Windows the
win32 connect-check sul probes racer fds directly, and on POSIX once the
racing fd actually gets its POLLOUT.1 parent 5a86bc7 commit 14a8791
1 file changed
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
496 | | - | |
| 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 | + | |
497 | 521 | | |
| 522 | + | |
498 | 523 | | |
499 | 524 | | |
500 | 525 | | |
| |||
0 commit comments