diff options
| author | Garrett D'Amore <garrett@damore.org> | 2021-12-25 18:01:49 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2021-12-25 18:05:56 -0800 |
| commit | 7b02ddc2d7077439992a10bb69553f89b5ee5903 (patch) | |
| tree | c3c6467330be2b38491f0df061d7016e713b1892 /src/sp/protocol/pair1/pair.c | |
| parent | 6237d268514e1f8aec562052954db22c4540eec3 (diff) | |
| download | nng-7b02ddc2d7077439992a10bb69553f89b5ee5903.tar.gz nng-7b02ddc2d7077439992a10bb69553f89b5ee5903.tar.bz2 nng-7b02ddc2d7077439992a10bb69553f89b5ee5903.zip | |
Socket and context initialization never fails.
This makes these functions entirely bullet proof, and eliminates
yet more error handling cases.
Diffstat (limited to 'src/sp/protocol/pair1/pair.c')
| -rw-r--r-- | src/sp/protocol/pair1/pair.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/sp/protocol/pair1/pair.c b/src/sp/protocol/pair1/pair.c index 636e51e9..e98e1ed9 100644 --- a/src/sp/protocol/pair1/pair.c +++ b/src/sp/protocol/pair1/pair.c @@ -91,7 +91,7 @@ pair1_add_sock_stat( } #endif -static int +static void pair1_sock_init_impl(void *arg, nni_sock *sock, bool raw) { pair1_sock *s = arg; @@ -179,20 +179,18 @@ pair1_sock_init_impl(void *arg, nni_sock *sock, bool raw) nni_stat_set_bool(&s->stat_raw, raw); nni_stat_set_bool(&s->stat_poly, false); #endif - - return (0); } -static int +static void pair1_sock_init(void *arg, nni_sock *sock) { - return (pair1_sock_init_impl(arg, sock, false)); + pair1_sock_init_impl(arg, sock, false); } -static int +static void pair1_sock_init_raw(void *arg, nni_sock *sock) { - return (pair1_sock_init_impl(arg, sock, true)); + pair1_sock_init_impl(arg, sock, true); } static void @@ -540,7 +538,7 @@ pair1_sock_send(void *arg, nni_aio *aio) #endif // Raw mode messages have the header already formed, with a hop count. - // Cooked mode messages have no header so we have to add one. + // Cooked mode messages have no header, so we have to add one. if (s->raw) { if ((nni_msg_header_len(m) != sizeof(uint32_t)) || (nni_msg_header_peek_u32(m) >= 0xff)) { @@ -551,7 +549,7 @@ pair1_sock_send(void *arg, nni_aio *aio) } else { // Strip off any previously existing header, such as when - // replying to messages. + // replying to a message. nni_msg_header_clear(m); nni_msg_header_append_u32(m, 0); } @@ -573,7 +571,7 @@ inject: return; } - // Can we maybe queue it. + // Can we queue it? if (nni_lmq_put(&s->wmq, m) == 0) { // Yay, we can. So we're done. nni_aio_set_msg(aio, NULL); |
