diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-01-06 06:44:36 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-01-06 06:44:36 -0800 |
| commit | 601d7a6ca95678613ca576258314f50a6e5e742c (patch) | |
| tree | bc96961a22e938bf162aa4f99410c0a7d630069b /src/protocol/pubsub/sub.c | |
| parent | 621be916af307939f1bdcffe591bb139878bc48d (diff) | |
| download | nng-601d7a6ca95678613ca576258314f50a6e5e742c.tar.gz nng-601d7a6ca95678613ca576258314f50a6e5e742c.tar.bz2 nng-601d7a6ca95678613ca576258314f50a6e5e742c.zip | |
Start of PUB/SUB testing. Fixed a subscribe bug.
Diffstat (limited to 'src/protocol/pubsub/sub.c')
| -rw-r--r-- | src/protocol/pubsub/sub.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/protocol/pubsub/sub.c b/src/protocol/pubsub/sub.c index 4908466f..6cd22712 100644 --- a/src/protocol/pubsub/sub.c +++ b/src/protocol/pubsub/sub.c @@ -173,6 +173,7 @@ nni_sub_subscribe(nni_sub_sock *sub, const void *buf, size_t sz) NNI_LIST_FOREACH (&sub->topics, topic) { int rv; + if (topic->len >= sz) { rv = memcmp(topic->buf, buf, sz); } else { @@ -201,6 +202,8 @@ nni_sub_subscribe(nni_sub_sock *sub, const void *buf, size_t sz) newtopic->len = sz; if (topic != NULL) { nni_list_insert_before(&sub->topics, newtopic, topic); + } else { + nni_list_append(&sub->topics, newtopic); } return (0); } |
