diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-04-24 15:32:24 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-04-24 15:32:24 -0700 |
| commit | c337628a3a4ec6bbad4fe062bd281f13ce455e54 (patch) | |
| tree | 2224e6ad2e1161210ed1fb2fee4383b87fd1ad22 | |
| parent | fdefff742662ed4eb476bf19b9dda245f86bc406 (diff) | |
| download | nng-c337628a3a4ec6bbad4fe062bd281f13ce455e54.tar.gz nng-c337628a3a4ec6bbad4fe062bd281f13ce455e54.tar.bz2 nng-c337628a3a4ec6bbad4fe062bd281f13ce455e54.zip | |
fixes #364 kill off nni_msgq_set_best_effort()
| -rw-r--r-- | src/core/msgqueue.c | 27 | ||||
| -rw-r--r-- | src/core/msgqueue.h | 6 |
2 files changed, 2 insertions, 31 deletions
diff --git a/src/core/msgqueue.c b/src/core/msgqueue.c index 7c33b256..a4a7ff36 100644 --- a/src/core/msgqueue.c +++ b/src/core/msgqueue.c @@ -24,7 +24,6 @@ struct nni_msgq { int mq_put; int mq_puterr; int mq_geterr; - bool mq_besteffort; bool mq_closed; nni_msg **mq_msgs; @@ -249,32 +248,11 @@ nni_msgq_run_putq(nni_msgq *mq) continue; } - // If we are in best effort mode, just drop the message - // as if we delivered. - if (mq->mq_besteffort) { - nni_list_remove(&mq->mq_aio_putq, waio); - nni_aio_set_msg(waio, NULL); - nni_msg_free(msg); - nni_aio_finish(waio, 0, len); - continue; - } - // Unable to make progress, leave the aio where it is. break; } } -void -nni_msgq_set_best_effort(nni_msgq *mq, bool on) -{ - nni_mtx_lock(&mq->mq_lock); - mq->mq_besteffort = on; - if (on) { - nni_msgq_run_putq(mq); - } - nni_mtx_unlock(&mq->mq_lock); -} - static void nni_msgq_run_getq(nni_msgq *mq) { @@ -373,11 +351,10 @@ nni_msgq_aio_put(nni_msgq *mq, nni_aio *aio) } // If this is an instantaneous poll operation, and the queue has - // no room, nobody is waiting to receive, and we're not best effort - // (best effort discards), then report the error (NNG_ETIMEDOUT). + // no room, nobody is waiting to receive, then report NNG_ETIMEDOUT. rv = nni_aio_schedule_verify(aio, nni_msgq_cancel, mq); if ((rv != 0) && (mq->mq_len >= mq->mq_cap) && - (nni_list_empty(&mq->mq_aio_getq)) && (!mq->mq_besteffort)) { + (nni_list_empty(&mq->mq_aio_getq))) { nni_mtx_unlock(&mq->mq_lock); nni_aio_finish_error(aio, rv); return; diff --git a/src/core/msgqueue.h b/src/core/msgqueue.h index 65215bd0..7dc5800d 100644 --- a/src/core/msgqueue.h +++ b/src/core/msgqueue.h @@ -63,12 +63,6 @@ extern void nni_msgq_set_put_error(nni_msgq *, int); // Readers (nni_msgq_put*) are unaffected. extern void nni_msgq_set_get_error(nni_msgq *, int); -// nni_msgq_set_best_effort marks the message queue best effort on send. -// What this does is treat the message queue condition as if it were -// successful, returning 0, and discarding the message. If zero is -// passed then this mode is reset to normal. -extern void nni_msgq_set_best_effort(nni_msgq *, bool); - // nni_msgq_filter is a callback function used to filter messages. // The function is called on entry (put) or exit (get). The void // argument is an opaque pointer supplied with the function at registration |
