aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-06-14 15:40:21 -0700
committerGarrett D'Amore <garrett@damore.org>2018-06-14 15:40:21 -0700
commit16088417694de3d3300ae8429c20e944128d3f52 (patch)
tree2bf6101e7f46842bf390b2883d512e6bbdeadaa0 /src
parentccbaa84e9850f932da49c4a93fcc5e97e45d63a4 (diff)
downloadnng-16088417694de3d3300ae8429c20e944128d3f52.tar.gz
nng-16088417694de3d3300ae8429c20e944128d3f52.tar.bz2
nng-16088417694de3d3300ae8429c20e944128d3f52.zip
fixes #545 uaio assertion error in ws
Diffstat (limited to 'src')
-rw-r--r--src/supplemental/websocket/websocket.c10
1 files changed, 7 insertions, 3 deletions
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);