diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-09 23:45:21 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-11-11 11:03:12 -0800 |
| commit | 713b80f440cb414cd0b856bde0ea1b31f939777f (patch) | |
| tree | 1186c42418559c85719023bde3e919aa2df7fcef /src/sp/protocol | |
| parent | cbe9a27ef7485977fbc7c713376b096b6723da3d (diff) | |
| download | nng-713b80f440cb414cd0b856bde0ea1b31f939777f.tar.gz nng-713b80f440cb414cd0b856bde0ea1b31f939777f.tar.bz2 nng-713b80f440cb414cd0b856bde0ea1b31f939777f.zip | |
refactor initialization/finalization
Applications must now call nng_init(), but they can supply
a set of parameters optionally. The code is now safe for
multiple libraries to do this concurrently, meaning nng_fini
no longer can race against another instance starting up.
The nni_init checks on all public APIs are removed now.
Diffstat (limited to 'src/sp/protocol')
| -rw-r--r-- | src/sp/protocol/pubsub0/sub.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/sp/protocol/pubsub0/sub.c b/src/sp/protocol/pubsub0/sub.c index a4741114..1b17fcbf 100644 --- a/src/sp/protocol/pubsub0/sub.c +++ b/src/sp/protocol/pubsub0/sub.c @@ -711,8 +711,7 @@ nng_sub0_socket_subscribe(nng_socket id, const void *buf, size_t sz) nni_sock *s; sub0_sock *sock; - if (((rv = nni_init()) != 0) || - ((rv = nni_sock_find(&s, id.id)) != 0)) { + if ((rv = nni_sock_find(&s, id.id)) != 0) { return (rv); } // validate the socket type @@ -733,8 +732,7 @@ nng_sub0_socket_unsubscribe(nng_socket id, const void *buf, size_t sz) nni_sock *s; sub0_sock *sock; - if (((rv = nni_init()) != 0) || - ((rv = nni_sock_find(&s, id.id)) != 0)) { + if ((rv = nni_sock_find(&s, id.id)) != 0) { return (rv); } // validate the socket type @@ -755,8 +753,7 @@ nng_sub0_ctx_subscribe(nng_ctx id, const void *buf, size_t sz) nni_ctx *c; sub0_ctx *ctx; - if (((rv = nni_init()) != 0) || - ((rv = nni_ctx_find(&c, id.id, false)) != 0)) { + if ((rv = nni_ctx_find(&c, id.id, false)) != 0) { return (rv); } // validate the socket type @@ -777,8 +774,7 @@ nng_sub0_ctx_unsubscribe(nng_ctx id, const void *buf, size_t sz) nni_ctx *c; sub0_ctx *ctx; - if (((rv = nni_init()) != 0) || - ((rv = nni_ctx_find(&c, id.id, false)) != 0)) { + if ((rv = nni_ctx_find(&c, id.id, false)) != 0) { return (rv); } // validate the socket type |
