aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/pubsub
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/pubsub
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/pubsub')
-rw-r--r--src/protocol/pubsub/pub.c5
-rw-r--r--src/protocol/pubsub/sub.c5
2 files changed, 2 insertions, 8 deletions
diff --git a/src/protocol/pubsub/pub.c b/src/protocol/pubsub/pub.c
index 4604d0ff..29863322 100644
--- a/src/protocol/pubsub/pub.c
+++ b/src/protocol/pubsub/pub.c
@@ -30,7 +30,6 @@ static void pub_pipe_fini(void *);
// A pub_sock is our per-socket protocol private structure.
struct pub_sock {
- nni_sock *sock;
nni_msgq *uwq;
int raw;
nni_aio * aio_getq;
@@ -75,8 +74,7 @@ pub_sock_init(void **sp, nni_sock *sock)
return (rv);
}
- s->sock = sock;
- s->raw = 0;
+ s->raw = 0;
NNI_LIST_INIT(&s->pipes, pub_pipe, node);
s->uwq = nni_sock_sendq(sock);
@@ -291,7 +289,6 @@ pub_sock_send(void *arg, nni_aio *aio)
{
pub_sock *s = arg;
- nni_sock_send_pending(s->sock);
nni_msgq_aio_put(s->uwq, aio);
}
diff --git a/src/protocol/pubsub/sub.c b/src/protocol/pubsub/sub.c
index 323bbb2f..d87b42ec 100644
--- a/src/protocol/pubsub/sub.c
+++ b/src/protocol/pubsub/sub.c
@@ -36,7 +36,6 @@ struct sub_topic {
// An nni_rep_sock is our per-socket protocol private structure.
struct sub_sock {
- nni_sock *sock;
nni_list topics;
nni_msgq *urq;
int raw;
@@ -61,8 +60,7 @@ sub_sock_init(void **sp, nni_sock *sock)
}
nni_mtx_init(&s->lk);
NNI_LIST_INIT(&s->topics, sub_topic, node);
- s->sock = sock;
- s->raw = 0;
+ s->raw = 0;
s->urq = nni_sock_recvq(sock);
*sp = s;
@@ -296,7 +294,6 @@ sub_sock_recv(void *arg, nni_aio *aio)
{
sub_sock *s = arg;
- nni_sock_recv_pending(s->sock);
nni_msgq_aio_get(s->urq, aio);
}