* NEW [nano_tcp] lmq can resize automatically according to needs
@@ -300,12 +300,14 @@ nano_ctx_send(void *arg, nni_aio *aio)
}
debug_msg("WARNING: pipe %d occupied! resending in cb!", pipe);
if (nni_lmq_full(&p->rlmq)) {
- // Make space for the new message.
- debug_msg("warning msg dropped!");
+ // Make space for the new message. TODO add max limit of msgq len in conf
+ if (rv = nni_lmq_resize(&p->rlmq, nni_lmq_cap(&p->rlmq) * 2) != 0) {
+ debug_syslog("warning msg dropped!");
nni_msg *old;
(void) nni_lmq_getq(&p->rlmq, &old);
nni_msg_free(old);
}
+ }
nni_lmq_putq(&p->rlmq, msg);
nni_mtx_unlock(&p->lk);
