From 3298ac1e93742e7a1ef5c4dc2e9b603dfa89d3cb Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 29 Dec 2023 17:43:50 -0800 Subject: fixes #1740 Public ID hash API This includes a manual page documenting the entire set of functions in one step. The hash is 64-bit based for now, to be maximally flexible. An internal 32-bit convenience for the common internal use is also provided (not public). The public API includes a test suite. --- src/sp/protocol/reqrep0/req.c | 2 +- src/sp/protocol/survey0/survey.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/sp') diff --git a/src/sp/protocol/reqrep0/req.c b/src/sp/protocol/reqrep0/req.c index 7e3e3db8..35c496f0 100644 --- a/src/sp/protocol/reqrep0/req.c +++ b/src/sp/protocol/reqrep0/req.c @@ -717,7 +717,7 @@ req0_ctx_send(void *arg, nni_aio *aio) req0_ctx_reset(ctx); // Insert us on the per ID hash list, so that receives can find us. - if ((rv = nni_id_alloc(&s->requests, &ctx->request_id, ctx)) != 0) { + if ((rv = nni_id_alloc32(&s->requests, &ctx->request_id, ctx)) != 0) { nni_mtx_unlock(&s->mtx); nni_aio_finish_error(aio, rv); return; diff --git a/src/sp/protocol/survey0/survey.c b/src/sp/protocol/survey0/survey.c index 18074016..dc7346c7 100644 --- a/src/sp/protocol/survey0/survey.c +++ b/src/sp/protocol/survey0/survey.c @@ -220,7 +220,7 @@ surv0_ctx_send(void *arg, nni_aio *aio) surv0_ctx_abort(ctx, NNG_ECANCELED); // Allocate the new ID. - if ((rv = nni_id_alloc(&sock->surveys, &ctx->survey_id, ctx)) != 0) { + if ((rv = nni_id_alloc32(&sock->surveys, &ctx->survey_id, ctx)) != 0) { nni_mtx_unlock(&sock->mtx); nni_aio_finish_error(aio, rv); return; -- cgit v1.2.3-70-g09d2