From 3dfa962c0d43a59d74c7798c65505082a5c69484 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 28 Nov 2024 11:20:22 -0500 Subject: ctx: Simplify handling for closed contexts. Once a context has started the process of close, further attempts to close it will return NNG_ECLOSED. What was I thinking to ever do anything else? --- src/core/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/socket.c') diff --git a/src/core/socket.c b/src/core/socket.c index 9b4ed308..fe1b62d2 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1030,7 +1030,7 @@ nni_sock_set_pipe_cb(nni_sock *s, int ev, nng_pipe_cb cb, void *arg) } int -nni_ctx_find(nni_ctx **cp, uint32_t id, bool closing) +nni_ctx_find(nni_ctx **cp, uint32_t id) { int rv = 0; nni_ctx *ctx; @@ -1043,7 +1043,7 @@ nni_ctx_find(nni_ctx **cp, uint32_t id, bool closing) // we can close it, then we still allow. In the case // the only valid operation will be to close the // socket.) - if (ctx->c_closed || ((!closing) && ctx->c_sock->s_closed)) { + if (ctx->c_closed || ctx->c_sock->s_closed) { rv = NNG_ECLOSED; } else { ctx->c_ref++; -- cgit v1.2.3-70-g09d2