From 16088417694de3d3300ae8429c20e944128d3f52 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 14 Jun 2018 15:40:21 -0700 Subject: fixes #545 uaio assertion error in ws --- src/supplemental/websocket/websocket.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/supplemental/websocket/websocket.c b/src/supplemental/websocket/websocket.c index bdb1a5b5..de10cd59 100644 --- a/src/supplemental/websocket/websocket.c +++ b/src/supplemental/websocket/websocket.c @@ -1256,11 +1256,13 @@ ws_http_cb_dialer(nni_ws *ws, nni_aio *aio) uaio = ws->useraio; nni_mtx_lock(&d->mtx); - NNI_ASSERT(uaio != NULL); // We have two steps. In step 1, we just sent the request, // and need to retrieve the reply. In step two we have // received the reply, and need to validate it. - if ((rv = nni_aio_result(aio)) != 0) { + // Note that its possible that the user canceled the request, + // in which case we no longer care, and just go to the error + // case to discard the ws. + if (((rv = nni_aio_result(aio)) != 0) || (uaio == NULL)) { goto err; } @@ -1343,7 +1345,9 @@ err: if (nni_list_empty(&d->wspend)) { nni_cv_wake(&d->cv); } - nni_aio_finish_error(uaio, rv); + if (uaio != NULL) { + nni_aio_finish_error(uaio, rv); + } nni_mtx_unlock(&d->mtx); nni_ws_fini(ws); -- cgit v1.2.3-70-g09d2