diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-01-06 10:07:19 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-01-06 10:07:19 -0800 |
| commit | 59a4b69c7989ac4fef1645f929abfa91b884215b (patch) | |
| tree | 5ac708af2420fbc67b17ae25bfe253878012bea6 /src/protocol/pubsub/sub.c | |
| parent | a2801adffebb6a3679e41789b38ba925ed32832b (diff) | |
| download | nng-59a4b69c7989ac4fef1645f929abfa91b884215b.tar.gz nng-59a4b69c7989ac4fef1645f929abfa91b884215b.tar.bz2 nng-59a4b69c7989ac4fef1645f929abfa91b884215b.zip | |
Fixes for PUB/SUB.
This fixes several issues, and brings PUB/SUB to operational
correctness. Included is test code to verify that.
Diffstat (limited to 'src/protocol/pubsub/sub.c')
| -rw-r--r-- | src/protocol/pubsub/sub.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/protocol/pubsub/sub.c b/src/protocol/pubsub/sub.c index 1243ca47..19c06aa0 100644 --- a/src/protocol/pubsub/sub.c +++ b/src/protocol/pubsub/sub.c @@ -200,6 +200,7 @@ nni_sub_subscribe(nni_sub_sock *sub, const void *buf, size_t sz) } NNI_LIST_NODE_INIT(&newtopic->node); newtopic->len = sz; + memcpy(newtopic->buf, buf, sz); if (topic != NULL) { nni_list_insert_before(&sub->topics, newtopic, topic); } else { @@ -306,6 +307,7 @@ nni_sub_recvfilter(void *arg, nni_msg *msg) body = nni_msg_body(msg); len = nni_msg_len(msg); + match = 0; // Check to see if the message matches one of our subscriptions. NNI_LIST_FOREACH (&sub->topics, topic) { if (len >= topic->len) { @@ -329,7 +331,7 @@ nni_sub_recvfilter(void *arg, nni_msg *msg) nni_msg_free(msg); return (NULL); } - return (0); + return (msg); } |
