aboutsummaryrefslogtreecommitdiff
path: root/src/protocol
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-06-21 14:04:16 -0700
committerGarrett D'Amore <garrett@damore.org>2017-06-21 14:04:16 -0700
commit763b8deee1fd38566b85d4745a83adae245d9b26 (patch)
tree00404dbc8e6c07fc5a9d8e07f353beff3adefd5a /src/protocol
parentf81c7e8cc84bd43bfc3cc5e41f773a0078870312 (diff)
downloadnng-763b8deee1fd38566b85d4745a83adae245d9b26.tar.gz
nng-763b8deee1fd38566b85d4745a83adae245d9b26.tar.bz2
nng-763b8deee1fd38566b85d4745a83adae245d9b26.zip
Make APIs for holding references more consistent.
Diffstat (limited to 'src/protocol')
-rw-r--r--src/protocol/bus/bus.c14
-rw-r--r--src/protocol/pair/pair.c12
-rw-r--r--src/protocol/pipeline/pull.c8
-rw-r--r--src/protocol/pipeline/push.c10
-rw-r--r--src/protocol/pubsub/pub.c10
-rw-r--r--src/protocol/pubsub/sub.c6
-rw-r--r--src/protocol/reqrep/rep.c14
-rw-r--r--src/protocol/reqrep/req.c16
-rw-r--r--src/protocol/survey/respond.c12
-rw-r--r--src/protocol/survey/survey.c12
10 files changed, 57 insertions, 57 deletions
diff --git a/src/protocol/bus/bus.c b/src/protocol/bus/bus.c
index e8428e42..ca24c32c 100644
--- a/src/protocol/bus/bus.c
+++ b/src/protocol/bus/bus.c
@@ -172,9 +172,9 @@ nni_bus_pipe_start(void *arg)
nni_list_append(&psock->pipes, ppipe);
- nni_pipe_incref(ppipe->npipe);
+ nni_pipe_hold(ppipe->npipe);
nni_bus_pipe_recv(ppipe);
- nni_pipe_incref(ppipe->npipe);
+ nni_pipe_hold(ppipe->npipe);
nni_bus_pipe_getq(ppipe);
return (0);
@@ -205,7 +205,7 @@ nni_bus_pipe_getq_cb(void *arg)
if (nni_aio_result(&ppipe->aio_getq) != 0) {
// closed?
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
return;
}
ppipe->aio_send.a_msg = ppipe->aio_getq.a_msg;
@@ -225,7 +225,7 @@ nni_bus_pipe_send_cb(void *arg)
nni_msg_free(ppipe->aio_send.a_msg);
ppipe->aio_send.a_msg = NULL;
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
return;
}
@@ -243,7 +243,7 @@ nni_bus_pipe_recv_cb(void *arg)
if (nni_aio_result(&ppipe->aio_recv) != 0) {
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
return;
}
msg = ppipe->aio_recv.a_msg;
@@ -253,7 +253,7 @@ nni_bus_pipe_recv_cb(void *arg)
// XXX: bump a nomemory stat
nni_msg_free(msg);
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
return;
}
@@ -271,7 +271,7 @@ nni_bus_pipe_putq_cb(void *arg)
nni_msg_free(ppipe->aio_putq.a_msg);
ppipe->aio_putq.a_msg = NULL;
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
return;
}
diff --git a/src/protocol/pair/pair.c b/src/protocol/pair/pair.c
index ed5cee9f..a2b97fe0 100644
--- a/src/protocol/pair/pair.c
+++ b/src/protocol/pair/pair.c
@@ -142,9 +142,9 @@ nni_pair_pipe_start(void *arg)
// Schedule a getq on the upper, and a read from the pipe.
// Each of these also sets up another hold on the pipe itself.
- nni_pipe_incref(ppipe->npipe);
+ nni_pipe_hold(ppipe->npipe);
nni_msgq_aio_get(psock->uwq, &ppipe->aio_getq);
- nni_pipe_incref(ppipe->npipe);
+ nni_pipe_hold(ppipe->npipe);
nni_pipe_aio_recv(ppipe->npipe, &ppipe->aio_recv);
return (0);
@@ -174,7 +174,7 @@ nni_pair_recv_cb(void *arg)
if (nni_aio_result(&ppipe->aio_recv) != 0) {
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
return;
}
@@ -193,7 +193,7 @@ nni_pair_putq_cb(void *arg)
nni_msg_free(ppipe->aio_putq.a_msg);
ppipe->aio_putq.a_msg = NULL;
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
return;
}
nni_pipe_aio_recv(ppipe->npipe, &ppipe->aio_recv);
@@ -209,7 +209,7 @@ nni_pair_getq_cb(void *arg)
if (nni_aio_result(&ppipe->aio_getq) != 0) {
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
return;
}
@@ -229,7 +229,7 @@ nni_pair_send_cb(void *arg)
nni_msg_free(ppipe->aio_send.a_msg);
ppipe->aio_send.a_msg = NULL;
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
return;
}
diff --git a/src/protocol/pipeline/pull.c b/src/protocol/pipeline/pull.c
index b569253d..eb14be81 100644
--- a/src/protocol/pipeline/pull.c
+++ b/src/protocol/pipeline/pull.c
@@ -107,7 +107,7 @@ nni_pull_pipe_start(void *arg)
nni_pull_pipe *pp = arg;
// Start the pending pull...
- nni_pipe_incref(pp->pipe);
+ nni_pipe_hold(pp->pipe);
nni_pull_recv(pp);
return (0);
@@ -134,7 +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);
+ nni_pipe_rele(pp->pipe);
return;
}
@@ -158,7 +158,7 @@ nni_pull_putq_cb(void *arg)
nni_msg_free(aio->a_msg);
aio->a_msg = NULL;
nni_pipe_close(pp->pipe);
- nni_pipe_decref(pp->pipe);
+ nni_pipe_rele(pp->pipe);
return;
}
@@ -173,7 +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);
+ nni_pipe_rele(pp->pipe);
}
}
diff --git a/src/protocol/pipeline/push.c b/src/protocol/pipeline/push.c
index 9691d8d8..9554b2be 100644
--- a/src/protocol/pipeline/push.c
+++ b/src/protocol/pipeline/push.c
@@ -127,11 +127,11 @@ nni_push_pipe_start(void *arg)
// Schedule a receiver. This is mostly so that we can detect
// a closed transport pipe.
- nni_pipe_incref(pp->pipe);
+ nni_pipe_hold(pp->pipe);
nni_pipe_aio_recv(pp->pipe, &pp->aio_recv);
// Schedule a sender.
- nni_pipe_incref(pp->pipe);
+ nni_pipe_hold(pp->pipe);
nni_msgq_aio_get(push->uwq, &pp->aio_getq);
return (0);
@@ -157,7 +157,7 @@ nni_push_recv_cb(void *arg)
// sends us data, we just discard it.
if (nni_aio_result(&pp->aio_recv) != 0) {
nni_pipe_close(pp->pipe);
- nni_pipe_decref(pp->pipe);
+ nni_pipe_rele(pp->pipe);
return;
}
nni_msg_free(pp->aio_recv.a_msg);
@@ -176,7 +176,7 @@ nni_push_send_cb(void *arg)
nni_msg_free(pp->aio_send.a_msg);
pp->aio_send.a_msg = NULL;
nni_pipe_close(pp->pipe);
- nni_pipe_decref(pp->pipe);
+ nni_pipe_rele(pp->pipe);
return;
}
@@ -193,7 +193,7 @@ nni_push_getq_cb(void *arg)
if (nni_aio_result(aio) != 0) {
// If the socket is closing, nothing else we can do.
nni_pipe_close(pp->pipe);
- nni_pipe_decref(pp->pipe);
+ nni_pipe_rele(pp->pipe);
return;
}
diff --git a/src/protocol/pubsub/pub.c b/src/protocol/pubsub/pub.c
index 8ca7f0f9..5ea16d2d 100644
--- a/src/protocol/pubsub/pub.c
+++ b/src/protocol/pubsub/pub.c
@@ -156,9 +156,9 @@ nni_pub_pipe_start(void *arg)
nni_list_append(&pub->pipes, pp);
// Start the receiver and the queue reader.
- nni_pipe_incref(pp->pipe);
+ nni_pipe_hold(pp->pipe);
nni_pipe_aio_recv(pp->pipe, &pp->aio_recv);
- nni_pipe_incref(pp->pipe);
+ nni_pipe_hold(pp->pipe);
nni_msgq_aio_get(pp->sendq, &pp->aio_getq);
return (0);
@@ -229,7 +229,7 @@ nni_pub_pipe_recv_cb(void *arg)
if (nni_aio_result(&pp->aio_recv) != 0) {
nni_pipe_close(pp->pipe);
- nni_pipe_decref(pp->pipe);
+ nni_pipe_rele(pp->pipe);
return;
}
@@ -246,7 +246,7 @@ nni_pub_pipe_getq_cb(void *arg)
if (nni_aio_result(&pp->aio_getq) != 0) {
nni_pipe_close(pp->pipe);
- nni_pipe_decref(pp->pipe);
+ nni_pipe_rele(pp->pipe);
return;
}
@@ -266,7 +266,7 @@ nni_pub_pipe_send_cb(void *arg)
nni_msg_free(pp->aio_send.a_msg);
pp->aio_send.a_msg = NULL;
nni_pipe_close(pp->pipe);
- nni_pipe_decref(pp->pipe);
+ nni_pipe_rele(pp->pipe);
return;
}
diff --git a/src/protocol/pubsub/sub.c b/src/protocol/pubsub/sub.c
index 7b6e908e..8340da77 100644
--- a/src/protocol/pubsub/sub.c
+++ b/src/protocol/pubsub/sub.c
@@ -117,7 +117,7 @@ nni_sub_pipe_start(void *arg)
{
nni_sub_pipe *sp = arg;
- nni_pipe_incref(sp->pipe);
+ nni_pipe_hold(sp->pipe);
nni_pipe_aio_recv(sp->pipe, &sp->aio_recv);
return (0);
}
@@ -142,7 +142,7 @@ nni_sub_recv_cb(void *arg)
if (nni_aio_result(&sp->aio_recv) != 0) {
nni_pipe_close(sp->pipe);
- nni_pipe_decref(sp->pipe);
+ nni_pipe_rele(sp->pipe);
return;
}
@@ -161,7 +161,7 @@ nni_sub_putq_cb(void *arg)
nni_msg_free(sp->aio_putq.a_msg);
sp->aio_putq.a_msg = NULL;
nni_pipe_close(sp->pipe);
- nni_pipe_decref(sp->pipe);
+ nni_pipe_rele(sp->pipe);
return;
}
diff --git a/src/protocol/reqrep/rep.c b/src/protocol/reqrep/rep.c
index 5a5f6bff..822758ef 100644
--- a/src/protocol/reqrep/rep.c
+++ b/src/protocol/reqrep/rep.c
@@ -182,9 +182,9 @@ nni_rep_pipe_start(void *arg)
return (rv);
}
- nni_pipe_incref(rp->pipe);
+ nni_pipe_hold(rp->pipe);
nni_msgq_aio_get(rp->sendq, &rp->aio_getq);
- nni_pipe_incref(rp->pipe);
+ nni_pipe_hold(rp->pipe);
nni_pipe_aio_recv(rp->pipe, &rp->aio_recv);
rp->running = 1;
return (0);
@@ -268,7 +268,7 @@ nni_rep_pipe_getq_cb(void *arg)
if (nni_aio_result(&rp->aio_getq) != 0) {
nni_pipe_close(rp->pipe);
- nni_pipe_decref(rp->pipe);
+ nni_pipe_rele(rp->pipe);
return;
}
@@ -288,7 +288,7 @@ nni_rep_pipe_send_cb(void *arg)
nni_msg_free(rp->aio_send.a_msg);
rp->aio_send.a_msg = NULL;
nni_pipe_close(rp->pipe);
- nni_pipe_decref(rp->pipe);
+ nni_pipe_rele(rp->pipe);
return;
}
@@ -309,7 +309,7 @@ nni_rep_pipe_recv_cb(void *arg)
if (nni_aio_result(&rp->aio_recv) != 0) {
nni_pipe_close(rp->pipe);
- nni_pipe_decref(rp->pipe);
+ nni_pipe_rele(rp->pipe);
return;
}
@@ -359,7 +359,7 @@ malformed:
// Failures here are bad enough to warrant to dropping the conn.
nni_msg_free(msg);
nni_pipe_close(rp->pipe);
- nni_pipe_decref(rp->pipe);
+ nni_pipe_rele(rp->pipe);
}
@@ -372,7 +372,7 @@ nni_rep_pipe_putq_cb(void *arg)
nni_msg_free(rp->aio_putq.a_msg);
rp->aio_putq.a_msg = NULL;
nni_pipe_close(rp->pipe);
- nni_pipe_decref(rp->pipe);
+ nni_pipe_rele(rp->pipe);
return;
}
diff --git a/src/protocol/reqrep/req.c b/src/protocol/reqrep/req.c
index af4dbd42..8268ecd6 100644
--- a/src/protocol/reqrep/req.c
+++ b/src/protocol/reqrep/req.c
@@ -187,9 +187,9 @@ nni_req_pipe_start(void *arg)
nni_req_resend(req);
}
- nni_pipe_incref(rp->pipe);
+ nni_pipe_hold(rp->pipe);
nni_msgq_aio_get(req->uwq, &rp->aio_getq);
- nni_pipe_incref(rp->pipe);
+ nni_pipe_hold(rp->pipe);
nni_pipe_aio_recv(rp->pipe, &rp->aio_recv);
rp->running = 1;
return (0);
@@ -294,7 +294,7 @@ nni_req_getq_cb(void *arg)
if (nni_aio_result(&rp->aio_getq) != 0) {
nni_pipe_close(rp->pipe);
- nni_pipe_decref(rp->pipe);
+ nni_pipe_rele(rp->pipe);
return;
}
@@ -316,7 +316,7 @@ nni_req_sendraw_cb(void *arg)
nni_msg_free(rp->aio_sendraw.a_msg);
rp->aio_sendraw.a_msg = NULL;
nni_pipe_close(rp->pipe);
- nni_pipe_decref(rp->pipe);
+ nni_pipe_rele(rp->pipe);
return;
}
@@ -339,7 +339,7 @@ nni_req_sendcooked_cb(void *arg)
nni_msg_free(rp->aio_sendcooked.a_msg);
rp->aio_sendcooked.a_msg = NULL;
nni_pipe_close(rp->pipe);
- nni_pipe_decref(rp->pipe);
+ nni_pipe_rele(rp->pipe);
return;
}
@@ -364,7 +364,7 @@ nni_req_putq_cb(void *arg)
if (nni_aio_result(&rp->aio_putq) != 0) {
nni_msg_free(rp->aio_putq.a_msg);
nni_pipe_close(rp->pipe);
- nni_pipe_decref(rp->pipe);
+ nni_pipe_rele(rp->pipe);
return;
}
rp->aio_putq.a_msg = NULL;
@@ -381,7 +381,7 @@ nni_req_recv_cb(void *arg)
if (nni_aio_result(&rp->aio_recv) != 0) {
nni_pipe_close(rp->pipe);
- nni_pipe_decref(rp->pipe);
+ nni_pipe_rele(rp->pipe);
return;
}
@@ -412,7 +412,7 @@ nni_req_recv_cb(void *arg)
malformed:
nni_msg_free(msg);
nni_pipe_close(rp->pipe);
- nni_pipe_decref(rp->pipe);
+ nni_pipe_rele(rp->pipe);
}
diff --git a/src/protocol/survey/respond.c b/src/protocol/survey/respond.c
index 3b8c5bd8..71220678 100644
--- a/src/protocol/survey/respond.c
+++ b/src/protocol/survey/respond.c
@@ -187,10 +187,10 @@ nni_resp_pipe_start(void *arg)
return (rv);
}
- nni_pipe_incref(ppipe->npipe);
+ nni_pipe_hold(ppipe->npipe);
nni_pipe_aio_recv(ppipe->npipe, &ppipe->aio_recv);
- nni_pipe_incref(ppipe->npipe);
+ nni_pipe_hold(ppipe->npipe);
nni_msgq_aio_get(ppipe->sendq, &ppipe->aio_getq);
ppipe->running = 1;
return (rv);
@@ -269,7 +269,7 @@ nni_resp_getq_cb(void *arg)
if (nni_aio_result(&ppipe->aio_getq) != 0) {
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
return;
}
@@ -289,7 +289,7 @@ nni_resp_send_cb(void *arg)
nni_msg_free(ppipe->aio_send.a_msg);
ppipe->aio_send.a_msg = NULL;
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
return;
}
@@ -359,7 +359,7 @@ nni_resp_recv_cb(void *arg)
error:
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
}
@@ -372,7 +372,7 @@ nni_resp_putq_cb(void *arg)
nni_msg_free(ppipe->aio_putq.a_msg);
ppipe->aio_putq.a_msg = NULL;
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
}
nni_pipe_aio_recv(ppipe->npipe, &ppipe->aio_recv);
diff --git a/src/protocol/survey/survey.c b/src/protocol/survey/survey.c
index 0edcfef2..f72532de 100644
--- a/src/protocol/survey/survey.c
+++ b/src/protocol/survey/survey.c
@@ -176,10 +176,10 @@ nni_surv_pipe_start(void *arg)
nni_list_append(&psock->pipes, ppipe);
- nni_pipe_incref(ppipe->npipe);
+ nni_pipe_hold(ppipe->npipe);
nni_msgq_aio_get(ppipe->sendq, &ppipe->aio_getq);
- nni_pipe_incref(ppipe->npipe);
+ nni_pipe_hold(ppipe->npipe);
nni_pipe_aio_recv(ppipe->npipe, &ppipe->aio_recv);
ppipe->running = 1;
return (0);
@@ -207,7 +207,7 @@ nni_surv_getq_cb(void *arg)
if (nni_aio_result(&ppipe->aio_getq) != 0) {
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
return;
}
@@ -227,7 +227,7 @@ nni_surv_send_cb(void *arg)
nni_msg_free(ppipe->aio_send.a_msg);
ppipe->aio_send.a_msg = NULL;
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
return;
}
@@ -244,7 +244,7 @@ nni_surv_putq_cb(void *arg)
nni_msg_free(ppipe->aio_putq.a_msg);
ppipe->aio_putq.a_msg = NULL;
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
return;
}
@@ -288,7 +288,7 @@ nni_surv_recv_cb(void *arg)
failed:
nni_pipe_close(ppipe->npipe);
- nni_pipe_decref(ppipe->npipe);
+ nni_pipe_rele(ppipe->npipe);
}