aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-07 00:56:31 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-07 00:56:31 -0800
commitb21a0bf8eb88ae47e1b8e85731ae9afb37988d61 (patch)
tree0269186d75f00348d6ab7c490b7f2987cb7f629a
parent0f9d86fe6931fd2e84651edb046930b62b590df3 (diff)
downloadnng-b21a0bf8eb88ae47e1b8e85731ae9afb37988d61.tar.gz
nng-b21a0bf8eb88ae47e1b8e85731ae9afb37988d61.tar.bz2
nng-b21a0bf8eb88ae47e1b8e85731ae9afb37988d61.zip
Pipeline fixes.
-rw-r--r--src/protocol/pipeline/push.c12
-rw-r--r--tests/pipeline.c2
2 files changed, 7 insertions, 7 deletions
diff --git a/src/protocol/pipeline/push.c b/src/protocol/pipeline/push.c
index 10c0ddf9..de774125 100644
--- a/src/protocol/pipeline/push.c
+++ b/src/protocol/pipeline/push.c
@@ -66,6 +66,7 @@ nni_push_init(void **pushp, nni_sock *sock)
push->raw = 0;
push->npipes = 0;
push->wantw = 0;
+ push->nextpipe = NULL;
push->uwq = nni_sock_sendq(sock);
*pushp = push;
nni_sock_recverr(sock, NNG_ENOTSUP);
@@ -143,12 +144,11 @@ nni_push_pipe_add(void *arg)
}
// Wake the sender since we have a new pipe.
nni_mtx_lock(&push->mx);
- if (push->nextpipe) {
- // Inject us right before the next pipe, so that we're next.
- nni_list_insert_before(&push->pipes, pp, push);
- } else {
- nni_list_append(&push->pipes, pp);
- }
+
+ // Turns out it should not really matter where we stick this.
+ // The end makes our test cases easier.
+ nni_list_append(&push->pipes, pp);
+
// Wake the top sender, as we can accept a job.
push->npipes++;
nni_cv_wake(&push->cv);
diff --git a/tests/pipeline.c b/tests/pipeline.c
index 53f1c50d..c2c774c4 100644
--- a/tests/pipeline.c
+++ b/tests/pipeline.c
@@ -129,6 +129,7 @@ Main({
So(nng_dial(pull1, addr, NULL, NNG_FLAG_SYNCH) == 0);
So(nng_dial(pull2, addr, NULL, NNG_FLAG_SYNCH) == 0);
So(nng_dial(pull3, addr, NULL, NNG_FLAG_SYNCH) == 0);
+ So(nng_shutdown(pull3) == 0);
// So pull3 might not be done accepting yet, but pull1
// and pull2 definitely are, because otherwise the
@@ -148,7 +149,6 @@ Main({
nng_msg_free(abc);
nng_msg_free(def);
- So(nng_recvmsg(pull3, &abc, 0) == NNG_ETIMEDOUT);
So(nng_recvmsg(pull1, &abc, 0) == NNG_ETIMEDOUT);
So(nng_recvmsg(pull2, &abc, 0) == NNG_ETIMEDOUT);
})