diff options
Diffstat (limited to 'src/protocol')
| -rw-r--r-- | src/protocol/pubsub/pub.c | 5 | ||||
| -rw-r--r-- | src/protocol/pubsub/sub.c | 4 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/protocol/pubsub/pub.c b/src/protocol/pubsub/pub.c index b1f91fe2..860c7c7d 100644 --- a/src/protocol/pubsub/pub.c +++ b/src/protocol/pubsub/pub.c @@ -121,7 +121,6 @@ nni_pub_pipe_add(void *arg) { nni_pub_pipe *pp = arg; nni_pub_sock *pub = pp->pub; - int rv; if (nni_pipe_peer(pp->pipe) != NNG_PROTO_SUB) { return (NNG_EPROTO); @@ -130,7 +129,7 @@ nni_pub_pipe_add(void *arg) nni_list_append(&pub->pipes, pp); nni_mtx_unlock(&pub->mx); - return (rv); + return (0); } @@ -173,7 +172,7 @@ nni_pub_broadcast(void *arg) } else { dup = msg; } - if ((rv = nni_msgq_tryput(pp->sendq, msg)) != 0) { + if ((rv = nni_msgq_tryput(pp->sendq, dup)) != 0) { nni_msg_free(dup); } } 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); } |
