diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-28 11:20:22 -0500 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-12-07 14:24:02 -0800 |
| commit | 3dfa962c0d43a59d74c7798c65505082a5c69484 (patch) | |
| tree | 9ee10ed99d341c48b02ed5e97409984582980b16 /src/core | |
| parent | 4f940cec0a6a5bcccd3ff0f389b66c169991968c (diff) | |
| download | nng-3dfa962c0d43a59d74c7798c65505082a5c69484.tar.gz nng-3dfa962c0d43a59d74c7798c65505082a5c69484.tar.bz2 nng-3dfa962c0d43a59d74c7798c65505082a5c69484.zip | |
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?
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/socket.c | 4 | ||||
| -rw-r--r-- | src/core/socket.h | 7 |
2 files changed, 4 insertions, 7 deletions
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++; diff --git a/src/core/socket.h b/src/core/socket.h index 3eb943f4..af8fd97d 100644 --- a/src/core/socket.h +++ b/src/core/socket.h @@ -73,11 +73,8 @@ extern void nni_sock_set_pipe_cb(nni_sock *sock, int, nng_pipe_cb, void *); // sockets (will also return NNG_ENOTSUP). extern int nni_ctx_open(nni_ctx **, nni_sock *); -// nni_ctx_find finds a context given its id. The last argument should -// be true if the context is acquired merely to close it, false otherwise. -// (If the socket for the context is being closed, then this will return -// NNG_ECLOSED unless the final argument is true.) -extern int nni_ctx_find(nni_ctx **, uint32_t, bool); +// nni_ctx_find finds a context given its id. +extern int nni_ctx_find(nni_ctx **, uint32_t); extern void *nni_ctx_proto_data(nni_ctx *); |
