diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-03-10 15:08:40 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-03-10 15:08:40 -0800 |
| commit | 046e60ceacd0219116d52d21352e14006ea254b0 (patch) | |
| tree | 8a99c4ccc1b88c109211cde2bc99b018f5fad962 /src/protocol/pipeline/pull.c | |
| parent | c50007e2ea5130c88aa27ed1c6d2cbcc4cd70f9b (diff) | |
| download | nng-046e60ceacd0219116d52d21352e14006ea254b0.tar.gz nng-046e60ceacd0219116d52d21352e14006ea254b0.tar.bz2 nng-046e60ceacd0219116d52d21352e14006ea254b0.zip | |
Pipeline is now race free (and simpler to boot!)
Diffstat (limited to 'src/protocol/pipeline/pull.c')
| -rw-r--r-- | src/protocol/pipeline/pull.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/protocol/pipeline/pull.c b/src/protocol/pipeline/pull.c index ec66fab6..622bd958 100644 --- a/src/protocol/pipeline/pull.c +++ b/src/protocol/pipeline/pull.c @@ -107,6 +107,7 @@ nni_pull_pipe_start(void *arg) nni_pull_pipe *pp = arg; // Start the pending pull... + nni_pipe_incref(pp->pipe); nni_pull_recv(pp); return (0); @@ -133,6 +134,7 @@ nni_pull_recv_cb(void *arg) if (nni_aio_result(aio) != 0) { // Failed to get a message, probably the pipe is closed. nni_pipe_close(pp->pipe); + nni_pipe_decref(pp->pipe); return; } @@ -153,7 +155,10 @@ nni_pull_putq_cb(void *arg) if (nni_aio_result(aio) != 0) { // If we failed to put, probably NNG_ECLOSED, nothing else // we can do. Just close the pipe. + nni_msg_free(aio->a_msg); + aio->a_msg = NULL; nni_pipe_close(pp->pipe); + nni_pipe_decref(pp->pipe); return; } @@ -168,6 +173,7 @@ nni_pull_recv(nni_pull_pipe *pp) // Schedule the aio with callback. if (nni_pipe_aio_recv(pp->pipe, &pp->recv_aio) != 0) { nni_pipe_close(pp->pipe); + nni_pipe_decref(pp->pipe); } } |
