From 13e380343c0eec96a723e7407d59fb7f5d20aba0 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 2 Jan 2017 17:35:49 -0800 Subject: Fixes to enable REQ/REP to operate. This uncovered a few problems - inproc was not moving the headers to the body on transmit, and the message chunk allocator had a serious bug leading to memory corruption. I've also added a message dumper, which turns out to be incredibly useful during debugging. --- src/transport/inproc/inproc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/transport') diff --git a/src/transport/inproc/inproc.c b/src/transport/inproc/inproc.c index ff0e9a2e..530e7ccf 100644 --- a/src/transport/inproc/inproc.c +++ b/src/transport/inproc/inproc.c @@ -132,7 +132,17 @@ static int nni_inproc_pipe_send(void *arg, nni_msg *msg) { nni_inproc_pipe *pipe = arg; - + char *h; + size_t l; + + // We need to move any header data to the body, because the other + // side won't know what to do otherwise. + h = nni_msg_header(msg, &l); + if (nni_msg_prepend(msg, h, l) != 0) { + nni_msg_free(msg); + return (0); // Pretend we sent it. + } + nni_msg_trim_header(msg, l); return (nni_msgq_put(pipe->wq, msg)); } -- cgit v1.2.3-70-g09d2