aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-07-02 16:09:14 -0700
committerGarrett D'Amore <garrett@damore.org>2017-07-02 16:09:14 -0700
commit4ed9dadf5e7d17fd42ef4df836b0932972dd29c1 (patch)
treede5581a25a0a8d16a3efc74197c8784b30d827bd /src
parentac1cdf1a4a2bff6d2ad469735d6825881f5045d9 (diff)
downloadnng-4ed9dadf5e7d17fd42ef4df836b0932972dd29c1.tar.gz
nng-4ed9dadf5e7d17fd42ef4df836b0932972dd29c1.tar.bz2
nng-4ed9dadf5e7d17fd42ef4df836b0932972dd29c1.zip
Use common aio cancellation.
Diffstat (limited to 'src')
-rw-r--r--src/core/msgqueue.c12
-rw-r--r--src/core/msgqueue.h1
-rw-r--r--src/core/socket.c10
-rw-r--r--src/protocol/survey/respond.c2
-rw-r--r--src/protocol/survey/survey.c2
5 files changed, 2 insertions, 25 deletions
diff --git a/src/core/msgqueue.c b/src/core/msgqueue.c
index 3d373e2b..19ca116e 100644
--- a/src/core/msgqueue.c
+++ b/src/core/msgqueue.c
@@ -441,18 +441,6 @@ nni_msgq_aio_get(nni_msgq *mq, nni_aio *aio)
}
-void
-nni_msgq_aio_cancel(nni_msgq *mq, nni_aio *aio)
-{
- nni_mtx_lock(&mq->mq_lock);
- if (nni_list_active(&mq->mq_aio_getq, aio)) {
- nni_list_remove(&mq->mq_aio_getq, aio);
- nni_aio_finish(aio, NNG_ECANCELED, 0);
- }
- nni_mtx_unlock(&mq->mq_lock);
-}
-
-
int
nni_msgq_canput(nni_msgq *mq)
{
diff --git a/src/core/msgqueue.h b/src/core/msgqueue.h
index 682c9821..af3bc835 100644
--- a/src/core/msgqueue.h
+++ b/src/core/msgqueue.h
@@ -41,7 +41,6 @@ extern void nni_msgq_aio_put(nni_msgq *, nni_aio *);
extern void nni_msgq_aio_get(nni_msgq *, nni_aio *);
extern void nni_msgq_aio_notify_get(nni_msgq *, nni_aio *);
extern void nni_msgq_aio_notify_put(nni_msgq *, nni_aio *);
-extern void nni_msgq_aio_cancel(nni_msgq *, nni_aio *);
// nni_msgq_put puts the message to the queue. It blocks until it
// was able to do so, or the queue is closed, returning either 0 on
diff --git a/src/core/socket.c b/src/core/socket.c
index 4535d2f4..d9d9ae3b 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -227,16 +227,6 @@ fail:
void
nni_sock_unnotify(nni_sock *sock, nni_notify *notify)
{
- switch (notify->n_type) {
- case NNG_EV_CAN_RCV:
- nni_msgq_aio_cancel(sock->s_urq, &notify->n_aio);
- break;
- case NNG_EV_CAN_SND:
- nni_msgq_aio_cancel(sock->s_uwq, &notify->n_aio);
- break;
- default:
- return;
- }
nni_aio_fini(&notify->n_aio);
NNI_FREE_STRUCT(notify);
}
diff --git a/src/protocol/survey/respond.c b/src/protocol/survey/respond.c
index 840b2582..73cc4792 100644
--- a/src/protocol/survey/respond.c
+++ b/src/protocol/survey/respond.c
@@ -119,7 +119,7 @@ nni_resp_sock_close(void *arg)
{
nni_resp_sock *psock = arg;
- nni_msgq_aio_cancel(psock->uwq, &psock->aio_getq);
+ nni_aio_stop(&psock->aio_getq);
}
diff --git a/src/protocol/survey/survey.c b/src/protocol/survey/survey.c
index bfbe5c1a..db2dd80c 100644
--- a/src/protocol/survey/survey.c
+++ b/src/protocol/survey/survey.c
@@ -117,7 +117,7 @@ nni_surv_sock_close(void *arg)
nni_surv_sock *psock = arg;
nni_timer_cancel(&psock->timer);
- nni_msgq_aio_cancel(psock->uwq, &psock->aio_getq);
+ nni_aio_stop(&psock->aio_getq);
}