summaryrefslogtreecommitdiff
path: root/src/core/msgqueue.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-04-24 15:32:24 -0700
committerGarrett D'Amore <garrett@damore.org>2018-04-24 15:32:24 -0700
commitc337628a3a4ec6bbad4fe062bd281f13ce455e54 (patch)
tree2224e6ad2e1161210ed1fb2fee4383b87fd1ad22 /src/core/msgqueue.c
parentfdefff742662ed4eb476bf19b9dda245f86bc406 (diff)
downloadnng-c337628a3a4ec6bbad4fe062bd281f13ce455e54.tar.gz
nng-c337628a3a4ec6bbad4fe062bd281f13ce455e54.tar.bz2
nng-c337628a3a4ec6bbad4fe062bd281f13ce455e54.zip
fixes #364 kill off nni_msgq_set_best_effort()
Diffstat (limited to 'src/core/msgqueue.c')
-rw-r--r--src/core/msgqueue.c27
1 files changed, 2 insertions, 25 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;