aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/reqrep/req.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-03-19 16:21:13 -0700
committerGarrett D'Amore <garrett@damore.org>2017-03-19 16:21:13 -0700
commitb8a133a9d6c5d8439c1f8ed3153d6a750aae3646 (patch)
tree0aed9586538b1330e836501612a66074093c32e8 /src/protocol/reqrep/req.c
parent351ae4c98f65e5cbc71c27d6ab6410fb6228ca54 (diff)
downloadnng-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/reqrep/req.c')
-rw-r--r--src/protocol/reqrep/req.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/protocol/reqrep/req.c b/src/protocol/reqrep/req.c
index f37913e6..af4dbd42 100644
--- a/src/protocol/reqrep/req.c
+++ b/src/protocol/reqrep/req.c
@@ -56,6 +56,7 @@ struct nni_req_pipe {
nni_aio aio_sendcooked; // cooked mode only
nni_aio aio_recv;
nni_aio aio_putq;
+ int running;
};
static void nni_req_resender(void *);
@@ -173,7 +174,7 @@ nni_req_pipe_fini(void *arg)
static int
-nni_req_pipe_add(void *arg)
+nni_req_pipe_start(void *arg)
{
nni_req_pipe *rp = arg;
nni_req_sock *req = rp->req;
@@ -190,16 +191,22 @@ nni_req_pipe_add(void *arg)
nni_msgq_aio_get(req->uwq, &rp->aio_getq);
nni_pipe_incref(rp->pipe);
nni_pipe_aio_recv(rp->pipe, &rp->aio_recv);
+ rp->running = 1;
return (0);
}
static void
-nni_req_pipe_rem(void *arg)
+nni_req_pipe_stop(void *arg)
{
nni_req_pipe *rp = arg;
nni_req_sock *req = rp->req;
+ if (!rp->running) {
+ return;
+ }
+ rp->running = 0;
+
// This removes the node from either busypipes or readypipes.
// It doesn't much matter which.
nni_list_remove(&req->readypipes, rp);
@@ -565,8 +572,8 @@ nni_req_sock_rfilter(void *arg, nni_msg *msg)
static nni_proto_pipe_ops nni_req_pipe_ops = {
.pipe_init = nni_req_pipe_init,
.pipe_fini = nni_req_pipe_fini,
- .pipe_add = nni_req_pipe_add,
- .pipe_rem = nni_req_pipe_rem,
+ .pipe_start = nni_req_pipe_start,
+ .pipe_stop = nni_req_pipe_stop,
};
static nni_proto_sock_ops nni_req_sock_ops = {