diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-01-05 18:49:49 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-01-05 18:49:49 -0800 |
| commit | a933bbbbf2399a3440442970e17b140e77c1203c (patch) | |
| tree | 032d25d14418a70d6b3d7640ea59b4a79f3de276 /src | |
| parent | 1b6e9985960a1079be81a576d52aa7f3fe47c92b (diff) | |
| download | nng-a933bbbbf2399a3440442970e17b140e77c1203c.tar.gz nng-a933bbbbf2399a3440442970e17b140e77c1203c.tar.bz2 nng-a933bbbbf2399a3440442970e17b140e77c1203c.zip | |
PUB protocol (untested).
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/core/msgqueue.c | 9 | ||||
| -rw-r--r-- | src/core/msgqueue.h | 6 | ||||
| -rw-r--r-- | src/core/protocol.c | 2 |
4 files changed, 17 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f07a6696..0f040f35 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -67,6 +67,7 @@ set (NNG_SOURCES protocol/pair/pair.c + protocol/pubsub/pub.c protocol/pubsub/sub.c protocol/reqrep/rep.c diff --git a/src/core/msgqueue.c b/src/core/msgqueue.c index 0f1872dc..a95057d2 100644 --- a/src/core/msgqueue.c +++ b/src/core/msgqueue.c @@ -323,6 +323,15 @@ nni_msgq_put(nni_msgq *mq, nni_msg *msg) int +nni_msgq_tryput(nni_msgq *mq, nni_msg *msg) +{ + nni_signal nosig = 0; + + return (nni_msgq_put_(mq, msg, NNI_TIME_ZERO, &nosig)); +} + + +int nni_msgq_put_sig(nni_msgq *mq, nni_msg *msg, nni_signal *signal) { return (nni_msgq_put_(mq, msg, NNI_TIME_NEVER, signal)); diff --git a/src/core/msgqueue.h b/src/core/msgqueue.h index 9ee4335a..6454e1df 100644 --- a/src/core/msgqueue.h +++ b/src/core/msgqueue.h @@ -43,8 +43,12 @@ extern void nni_msgq_fini(nni_msgq *); // the caller is not permitted to access it further. extern int nni_msgq_put(nni_msgq *, nni_msg *); +// nni_msgq_tryput is like nni_msgq_put, except that it does not block, +// if there is no room to put the message it simply returns NNG_EAGAIN. +extern int nni_msgq_tryput(nni_msgq *, nni_msg *); + // nni_msgq_putback returns a message to the head of the queue. -// This is a non-blocking operation, and it returns EAGAIN if there +// This is a non-blocking operation, and it returns NNG_EAGAIN if there // is no room. There is always at least room for one putback after // a message is retried with nni_msgq_get. extern int nni_msgq_putback(nni_msgq *, nni_msg *); diff --git a/src/core/protocol.c b/src/core/protocol.c index 765c2e9a..9b20a4fb 100644 --- a/src/core/protocol.c +++ b/src/core/protocol.c @@ -19,12 +19,14 @@ extern nni_proto nni_pair_proto; extern nni_proto nni_rep_proto; extern nni_proto nni_req_proto; +extern nni_proto nni_pub_proto; extern nni_proto nni_sub_proto; static nni_proto *protocols[] = { &nni_pair_proto, &nni_rep_proto, &nni_req_proto, + &nni_pub_proto, &nni_sub_proto, NULL }; |
