From b21a0bf8eb88ae47e1b8e85731ae9afb37988d61 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 7 Jan 2017 00:56:31 -0800 Subject: Pipeline fixes. --- src/protocol/pipeline/push.c | 12 ++++++------ tests/pipeline.c | 2 +- 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); }) -- cgit v1.2.3-70-g09d2