aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/survey/respond.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-10-25 15:00:52 -0700
committerGarrett D'Amore <garrett@damore.org>2017-10-25 18:29:47 -0700
commit9cbdeda1d0a9074bd65da2aaf9c87b79545a1590 (patch)
tree98254532f75a58cde92c837b4829bd2b3982db7a /src/protocol/survey/respond.c
parentb28838f5cf3c5fed494d2684422099d26e8ab293 (diff)
downloadnng-9cbdeda1d0a9074bd65da2aaf9c87b79545a1590.tar.gz
nng-9cbdeda1d0a9074bd65da2aaf9c87b79545a1590.tar.bz2
nng-9cbdeda1d0a9074bd65da2aaf9c87b79545a1590.zip
fixes #45 expose aio to applications
While here we added a test for the aio stuff, and cleaned up some dead code for the old fd notifications. There were a few improvements to shorten & clean code elsewhere, such as short-circuiting task wait when the task has no callback. The legacy sendmsg() and recvmsg() APIs are still in the socket core until we convert the device code to use the aios.
Diffstat (limited to 'src/protocol/survey/respond.c')
-rw-r--r--src/protocol/survey/respond.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/protocol/survey/respond.c b/src/protocol/survey/respond.c
index 4c3ea8e3..dbce0751 100644
--- a/src/protocol/survey/respond.c
+++ b/src/protocol/survey/respond.c
@@ -29,7 +29,6 @@ static void resp_pipe_fini(void *);
// A resp_sock is our per-socket protocol private structure.
struct resp_sock {
- nni_sock * nsock;
nni_msgq * urq;
nni_msgq * uwq;
int raw;
@@ -85,7 +84,6 @@ resp_sock_init(void **sp, nni_sock *nsock)
}
s->ttl = 8; // Per RFC
- s->nsock = nsock;
s->raw = 0;
s->btrace = NULL;
s->btrace_len = 0;
@@ -268,9 +266,9 @@ resp_send_cb(void *arg)
static void
resp_recv_cb(void *arg)
{
- resp_pipe *p = arg;
- resp_sock *s = p->psock;
- nni_msgq * urq;
+ resp_pipe *p = arg;
+ resp_sock *s = p->psock;
+ nni_msgq * urq = s->urq;
nni_msg * msg;
int hops;
int rv;
@@ -279,8 +277,6 @@ resp_recv_cb(void *arg)
goto error;
}
- urq = nni_sock_recvq(s->nsock);
-
msg = nni_aio_get_msg(p->aio_recv);
nni_aio_set_msg(p->aio_recv, NULL);
nni_msg_set_pipe(msg, p->id);
@@ -384,7 +380,6 @@ resp_sock_send(void *arg, nni_aio *aio)
nni_mtx_lock(&s->mtx);
if (s->raw) {
nni_mtx_unlock(&s->mtx);
- nni_sock_send_pending(s->nsock);
nni_msgq_aio_put(s->uwq, aio);
return;
}
@@ -413,7 +408,6 @@ resp_sock_send(void *arg, nni_aio *aio)
s->btrace_len = 0;
nni_mtx_unlock(&s->mtx);
- nni_sock_send_pending(s->nsock);
nni_msgq_aio_put(s->uwq, aio);
}
@@ -454,7 +448,6 @@ resp_sock_recv(void *arg, nni_aio *aio)
{
resp_sock *s = arg;
- nni_sock_recv_pending(s->nsock);
nni_msgq_aio_get(s->urq, aio);
}