aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/reqrep
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/reqrep
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/reqrep')
-rw-r--r--src/protocol/reqrep/rep.c5
-rw-r--r--src/protocol/reqrep/req.c9
2 files changed, 0 insertions, 14 deletions
diff --git a/src/protocol/reqrep/rep.c b/src/protocol/reqrep/rep.c
index 510beab3..5d924e32 100644
--- a/src/protocol/reqrep/rep.c
+++ b/src/protocol/reqrep/rep.c
@@ -29,7 +29,6 @@ static void rep_pipe_fini(void *);
// A rep_sock is our per-socket protocol private structure.
struct rep_sock {
- nni_sock * sock;
nni_msgq * uwq;
nni_msgq * urq;
nni_mtx lk;
@@ -84,7 +83,6 @@ rep_sock_init(void **sp, nni_sock *sock)
}
s->ttl = 8; // Per RFC
- s->sock = sock;
s->raw = 0;
s->btrace = NULL;
s->btrace_len = 0;
@@ -420,7 +418,6 @@ rep_sock_send(void *arg, nni_aio *aio)
if (s->raw) {
// Pass thru
nni_mtx_unlock(&s->lk);
- nni_sock_send_pending(s->sock);
nni_msgq_aio_put(s->uwq, aio);
return;
}
@@ -447,7 +444,6 @@ rep_sock_send(void *arg, nni_aio *aio)
s->btrace_len = 0;
nni_mtx_unlock(&s->lk);
- nni_sock_send_pending(s->sock);
nni_msgq_aio_put(s->uwq, aio);
}
@@ -456,7 +452,6 @@ rep_sock_recv(void *arg, nni_aio *aio)
{
rep_sock *s = arg;
- nni_sock_recv_pending(s->sock);
nni_msgq_aio_get(s->urq, aio);
}
diff --git a/src/protocol/reqrep/req.c b/src/protocol/reqrep/req.c
index 81abd306..1ab49f3e 100644
--- a/src/protocol/reqrep/req.c
+++ b/src/protocol/reqrep/req.c
@@ -28,7 +28,6 @@ static void req_pipe_fini(void *);
// A req_sock is our per-socket protocol private structure.
struct req_sock {
- nni_sock * sock;
nni_msgq * uwq;
nni_msgq * urq;
nni_duration retry;
@@ -90,7 +89,6 @@ req_sock_init(void **sp, nni_sock *sock)
// this is "semi random" start for request IDs.
s->nextid = nni_random();
s->retry = NNI_SECOND * 60;
- s->sock = sock;
s->reqmsg = NULL;
s->raw = 0;
s->wantw = 0;
@@ -512,7 +510,6 @@ req_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->sock);
nni_msgq_aio_put(s->uwq, aio);
return;
}
@@ -536,11 +533,6 @@ req_sock_send(void *arg, nni_aio *aio)
return;
}
- // XXX: I think we should just not do this... and leave the
- // socket "permanently writeable". This does screw up all the
- // backpressure.
- // nni_sock_send_pending(s->sock);
-
// If another message is there, this cancels it.
if (s->reqmsg != NULL) {
nni_msg_free(s->reqmsg);
@@ -619,7 +611,6 @@ req_sock_recv(void *arg, nni_aio *aio)
}
}
nni_mtx_unlock(&s->mtx);
- nni_sock_recv_pending(s->sock);
nni_msgq_aio_get(s->urq, aio);
}