diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-03-19 16:21:13 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-03-19 16:21:13 -0700 |
| commit | b8a133a9d6c5d8439c1f8ed3153d6a750aae3646 (patch) | |
| tree | 0aed9586538b1330e836501612a66074093c32e8 /src/protocol/survey/respond.c | |
| parent | 351ae4c98f65e5cbc71c27d6ab6410fb6228ca54 (diff) | |
| download | nng-b8a133a9d6c5d8439c1f8ed3153d6a750aae3646.tar.gz nng-b8a133a9d6c5d8439c1f8ed3153d6a750aae3646.tar.bz2 nng-b8a133a9d6c5d8439c1f8ed3153d6a750aae3646.zip | |
Eliminate p_active, better names for pipe start and stop.
Diffstat (limited to 'src/protocol/survey/respond.c')
| -rw-r--r-- | src/protocol/survey/respond.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/protocol/survey/respond.c b/src/protocol/survey/respond.c index a70b08e6..8fe12e19 100644 --- a/src/protocol/survey/respond.c +++ b/src/protocol/survey/respond.c @@ -48,6 +48,7 @@ struct nni_resp_pipe { nni_aio aio_putq; nni_aio aio_send; nni_aio aio_recv; + int running; }; static int @@ -173,7 +174,7 @@ nni_resp_pipe_fini(void *arg) static int -nni_resp_pipe_add(void *arg) +nni_resp_pipe_start(void *arg) { nni_resp_pipe *ppipe = arg; nni_resp_sock *psock = ppipe->psock; @@ -186,20 +187,24 @@ nni_resp_pipe_add(void *arg) nni_pipe_incref(ppipe->npipe); nni_msgq_aio_get(ppipe->sendq, &ppipe->aio_getq); + ppipe->running = 1; return (rv); } static void -nni_resp_pipe_rem(void *arg) +nni_resp_pipe_stop(void *arg) { nni_resp_pipe *ppipe = arg; nni_resp_sock *psock = ppipe->psock; - nni_idhash_remove(&psock->pipes, nni_pipe_id(ppipe->npipe)); + if (ppipe->running) { + ppipe->running = 0; + nni_idhash_remove(&psock->pipes, nni_pipe_id(ppipe->npipe)); - nni_msgq_close(ppipe->sendq); - nni_msgq_aio_cancel(psock->urq, &ppipe->aio_putq); + nni_msgq_close(ppipe->sendq); + nni_msgq_aio_cancel(psock->urq, &ppipe->aio_putq); + } } @@ -488,8 +493,8 @@ nni_resp_sock_rfilter(void *arg, nni_msg *msg) static nni_proto_pipe_ops nni_resp_pipe_ops = { .pipe_init = nni_resp_pipe_init, .pipe_fini = nni_resp_pipe_fini, - .pipe_add = nni_resp_pipe_add, - .pipe_rem = nni_resp_pipe_rem, + .pipe_start = nni_resp_pipe_start, + .pipe_stop = nni_resp_pipe_stop, }; static nni_proto_sock_ops nni_resp_sock_ops = { |
