aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/pair
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-10-19 18:20:30 -0700
committerGarrett D'Amore <garrett@damore.org>2017-10-19 18:20:30 -0700
commit640fbb7034c2bb299392ac34b095d18f96406da3 (patch)
tree9876582de9f041022c828feb83f08cced44da61f /src/protocol/pair
parent4e668fdd5b5da0d46f97d835249dbe5f0ea319a7 (diff)
downloadnng-640fbb7034c2bb299392ac34b095d18f96406da3.tar.gz
nng-640fbb7034c2bb299392ac34b095d18f96406da3.tar.bz2
nng-640fbb7034c2bb299392ac34b095d18f96406da3.zip
fixes #123 latency tests with wrong message size
Diffstat (limited to 'src/protocol/pair')
-rw-r--r--src/protocol/pair/pair_v1.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/protocol/pair/pair_v1.c b/src/protocol/pair/pair_v1.c
index a27203b2..6c9d4bd3 100644
--- a/src/protocol/pair/pair_v1.c
+++ b/src/protocol/pair/pair_v1.c
@@ -13,7 +13,9 @@
#include "core/nng_impl.h"
-// Pair protocol. The PAIRv1 protocol is a simple 1:1 messaging pattern.
+// Pair protocol. The PAIRv1 protocol is a simple 1:1 messaging pattern,
+// usually, but it can support a polyamorous mode where a single server can
+// communicate with multiple partners.
typedef struct pair1_pipe pair1_pipe;
typedef struct pair1_sock pair1_sock;
@@ -239,7 +241,7 @@ pair1_pipe_recv_cb(void *arg)
return;
}
- // Store the pipe id followed by the hop count.
+ // Store the hop count in the header.
if ((rv = nni_msg_header_append_u32(msg, hdr)) != 0) {
nni_msg_free(msg);
nni_pipe_recv(npipe, p->aio_recv);
@@ -338,6 +340,9 @@ pair1_pipe_getq_cb(void *arg)
}
hops = nni_msg_header_trim_u32(msg);
} else {
+ // Strip off any previously existing header, such as when
+ // replying to messages.
+ nni_msg_header_clear(msg);
hops = 0;
}