aboutsummaryrefslogtreecommitdiff
path: root/src/sp/protocol/pipeline0
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2021-12-25 18:01:49 -0800
committerGarrett D'Amore <garrett@damore.org>2021-12-25 18:05:56 -0800
commit7b02ddc2d7077439992a10bb69553f89b5ee5903 (patch)
treec3c6467330be2b38491f0df061d7016e713b1892 /src/sp/protocol/pipeline0
parent6237d268514e1f8aec562052954db22c4540eec3 (diff)
downloadnng-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/pipeline0')
-rw-r--r--src/sp/protocol/pipeline0/pull.c5
-rw-r--r--src/sp/protocol/pipeline0/push.c6
2 files changed, 4 insertions, 7 deletions
diff --git a/src/sp/protocol/pipeline0/pull.c b/src/sp/protocol/pipeline0/pull.c
index 616b0817..07d55405 100644
--- a/src/sp/protocol/pipeline0/pull.c
+++ b/src/sp/protocol/pipeline0/pull.c
@@ -1,5 +1,5 @@
//
-// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2021 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
//
// This software is supplied under the terms of the MIT License, a
@@ -47,7 +47,7 @@ struct pull0_pipe {
nni_list_node node;
};
-static int
+static void
pull0_sock_init(void *arg, nni_sock *sock)
{
pull0_sock *s = arg;
@@ -57,7 +57,6 @@ pull0_sock_init(void *arg, nni_sock *sock)
NNI_LIST_INIT(&s->pl, pull0_pipe, node);
nni_mtx_init(&s->m);
nni_pollable_init(&s->readable);
- return (0);
}
static void
diff --git a/src/sp/protocol/pipeline0/push.c b/src/sp/protocol/pipeline0/push.c
index 99cb2da4..09953ccf 100644
--- a/src/sp/protocol/pipeline0/push.c
+++ b/src/sp/protocol/pipeline0/push.c
@@ -51,7 +51,7 @@ struct push0_pipe {
nni_aio aio_send;
};
-static int
+static void
push0_sock_init(void *arg, nni_sock *sock)
{
push0_sock *s = arg;
@@ -62,8 +62,6 @@ push0_sock_init(void *arg, nni_sock *sock)
NNI_LIST_INIT(&s->pl, push0_pipe, node);
nni_lmq_init(&s->wq, 0); // initially we start unbuffered.
nni_pollable_init(&s->writable);
-
- return (0);
}
static void
@@ -299,7 +297,7 @@ push0_sock_send(void *arg, nni_aio *aio)
return;
}
- // Can we maybe queue it.
+ // Can we queue it?
if (nni_lmq_put(&s->wq, m) == 0) {
// Yay, we can. So we're done.
nni_aio_set_msg(aio, NULL);