Skip to content

Commit

Permalink
fixes #1734 websocket dialer hang on shutdown
Browse files Browse the repository at this point in the history
It's not absolutely clear that this fixes all of the possible
cases, but we're hopeful that this does -- and in any event the
bug does not seem to reproduce easily anymore.
  • Loading branch information
gdamore committed Dec 18, 2023
1 parent 8ff9663 commit 9528f41
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/supplemental/websocket/websocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1325,9 +1325,15 @@ ws_http_cb_dialer(nni_ws *ws, nni_aio *aio)
goto err;
}

// There is a race between the dialer closing and any connections
// that were in progress completing.
if (d->closed){
rv = NNG_ECLOSED;
goto err;

Check warning on line 1332 in src/supplemental/websocket/websocket.c

View check run for this annotation

Codecov / codecov/patch

src/supplemental/websocket/websocket.c#L1331-L1332

Added lines #L1331 - L1332 were not covered by tests
}

// If we have no response structure, then this was completion
// of the send of the request. Prepare an empty response, and
// read it.
// of sending the request. Prepare an empty response, and read it.
if (ws->res == NULL) {
if ((rv = nni_http_res_alloc(&ws->res)) != 0) {
goto err;
Expand Down

0 comments on commit 9528f41

Please sign in to comment.