diff options
| author | Garrett D'Amore <garrett@damore.org> | 2021-12-25 17:38:14 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2021-12-25 17:38:14 -0800 |
| commit | 6237d268514e1f8aec562052954db22c4540eec3 (patch) | |
| tree | 32213ea0016ae10faee2817f414308c91d881c42 /src/sp/protocol/pair1/pair.c | |
| parent | 7a54bcd6fe345f35dd51eede6c5d66e8516c16ab (diff) | |
| download | nng-6237d268514e1f8aec562052954db22c4540eec3.tar.gz nng-6237d268514e1f8aec562052954db22c4540eec3.tar.bz2 nng-6237d268514e1f8aec562052954db22c4540eec3.zip | |
Provide a tiny buf for lmq buffer by default.
This allows us to make nni_lmq_init() non-failing. (Although
the buffer size requested at initialization might not be granted.)
Diffstat (limited to 'src/sp/protocol/pair1/pair.c')
| -rw-r--r-- | src/sp/protocol/pair1/pair.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/sp/protocol/pair1/pair.c b/src/sp/protocol/pair1/pair.c index e6be4628..636e51e9 100644 --- a/src/sp/protocol/pair1/pair.c +++ b/src/sp/protocol/pair1/pair.c @@ -358,7 +358,7 @@ pair1_pipe_recv_cb(void *arg) // maybe we have room in the rmq? if (!nni_lmq_full(&s->rmq)) { - nni_lmq_putq(&s->rmq, msg); + nni_lmq_put(&s->rmq, msg); nni_aio_set_msg(&p->aio_recv, NULL); nni_pipe_recv(pipe, &p->aio_recv); } else { @@ -386,14 +386,14 @@ pair1_send_sched(pair1_sock *s) s->wr_ready = true; // if message waiting in buffered queue, then we prefer that. - if (nni_lmq_getq(&s->wmq, &m) == 0) { + if (nni_lmq_get(&s->wmq, &m) == 0) { pair1_pipe_send(p, m); if ((a = nni_list_first(&s->waq)) != NULL) { nni_aio_list_remove(a); m = nni_aio_get_msg(a); l = nni_msg_len(m); - nni_lmq_putq(&s->wmq, m); + nni_lmq_put(&s->wmq, m); } } else if ((a = nni_list_first(&s->waq)) != NULL) { @@ -452,8 +452,8 @@ pair1_sock_close(void *arg) nni_aio_list_remove(a); nni_aio_finish_error(a, NNG_ECLOSED); } - while ((nni_lmq_getq(&s->rmq, &m) == 0) || - (nni_lmq_getq(&s->wmq, &m) == 0)) { + while ((nni_lmq_get(&s->rmq, &m) == 0) || + (nni_lmq_get(&s->wmq, &m) == 0)) { nni_msg_free(m); } nni_mtx_unlock(&s->mtx); @@ -574,7 +574,7 @@ inject: } // Can we maybe queue it. - if (nni_lmq_putq(&s->wmq, m) == 0) { + if (nni_lmq_put(&s->wmq, m) == 0) { // Yay, we can. So we're done. nni_aio_set_msg(aio, NULL); nni_aio_finish(aio, 0, len); @@ -611,14 +611,14 @@ pair1_sock_recv(void *arg, nni_aio *aio) // Buffered read. If there is a message waiting for us, pick // it up. We might need to post another read request as well. - if (nni_lmq_getq(&s->rmq, &m) == 0) { + if (nni_lmq_get(&s->rmq, &m) == 0) { nni_aio_set_msg(aio, m); nni_aio_finish(aio, 0, nni_msg_len(m)); if (s->rd_ready) { s->rd_ready = false; m = nni_aio_get_msg(&p->aio_recv); nni_aio_set_msg(&p->aio_recv, NULL); - nni_lmq_putq(&s->rmq, m); + nni_lmq_put(&s->rmq, m); nni_pipe_recv(p->pipe, &p->aio_recv); } if (nni_lmq_empty(&s->rmq)) { |
