diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-08-20 09:00:46 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-08-20 09:26:20 -0700 |
| commit | 6e5f6a26beec0a44d25625cacb5095cdc7a94146 (patch) | |
| tree | 7d6ef720b239a30d4906f1f2303fed77707b2761 /src/supplemental/websocket/websocket.c | |
| parent | 3e70013111b70f1439b2f9991211c887a8eefff3 (diff) | |
| download | nng-6e5f6a26beec0a44d25625cacb5095cdc7a94146.tar.gz nng-6e5f6a26beec0a44d25625cacb5095cdc7a94146.tar.bz2 nng-6e5f6a26beec0a44d25625cacb5095cdc7a94146.zip | |
fixes #664 aio cancellation could be better
This changes the signature of the aio cancellation routines
to take the argument for cancellation directly, so we do not
need to lookup the argument using the nni_aio_get_prov_data.
We should probably consider eliminating nni_aio_get_prov_data,
and co, and changing the prov_extra to reflect prov_data. Later.
Diffstat (limited to 'src/supplemental/websocket/websocket.c')
| -rw-r--r-- | src/supplemental/websocket/websocket.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/supplemental/websocket/websocket.c b/src/supplemental/websocket/websocket.c index efa0fdf8..a1553704 100644 --- a/src/supplemental/websocket/websocket.c +++ b/src/supplemental/websocket/websocket.c @@ -517,9 +517,9 @@ ws_start_write(nni_ws *ws) } static void -ws_cancel_close(nni_aio *aio, int rv) +ws_cancel_close(nni_aio *aio, void *arg, int rv) { - nni_ws *ws = nni_aio_get_prov_data(aio); + nni_ws *ws = arg; nni_mtx_lock(&ws->mtx); if (ws->wclose) { ws->wclose = false; @@ -616,15 +616,13 @@ ws_write_cb(void *arg) } static void -ws_write_cancel(nni_aio *aio, int rv) +ws_write_cancel(nni_aio *aio, void *arg, int rv) { - nni_ws * ws; + nni_ws * ws = arg; ws_msg * wm; ws_frame *frame; - // Is this aio active? We can tell by looking at the - // active tx frame. - ws = nni_aio_get_prov_data(aio); + // Is this aio active? We can tell by looking at the active tx frame. nni_mtx_lock(&ws->mtx); if (!nni_aio_list_active(aio)) { @@ -1038,9 +1036,9 @@ ws_read_cb(void *arg) } static void -ws_read_cancel(nni_aio *aio, int rv) +ws_read_cancel(nni_aio *aio, void *arg, int rv) { - nni_ws *ws = nni_aio_get_prov_data(aio); + nni_ws *ws = arg; ws_msg *wm; nni_mtx_lock(&ws->mtx); @@ -1676,9 +1674,9 @@ nni_ws_listener_proto(nni_ws_listener *l, const char *proto) } static void -ws_accept_cancel(nni_aio *aio, int rv) +ws_accept_cancel(nni_aio *aio, void *arg, int rv) { - nni_ws_listener *l = nni_aio_get_prov_data(aio); + nni_ws_listener *l = arg; nni_mtx_lock(&l->mtx); if (nni_aio_list_active(aio)) { @@ -2031,9 +2029,9 @@ nni_ws_dialer_proto(nni_ws_dialer *d, const char *proto) } static void -ws_dial_cancel(nni_aio *aio, int rv) +ws_dial_cancel(nni_aio *aio, void *arg, int rv) { - nni_ws *ws = nni_aio_get_prov_data(aio); + nni_ws *ws = arg; nni_mtx_lock(&ws->mtx); if (aio == ws->useraio) { |
