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 authored and JaylinYu committed Dec 28, 2023
1 parent 926f5cb commit 1b38f38
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;
}

// 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 1b38f38

Please sign in to comment.