diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-01-06 08:18:50 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-01-06 08:21:09 -0800 |
| commit | a2801adffebb6a3679e41789b38ba925ed32832b (patch) | |
| tree | 8e3a743301fedb04d19d9af3e30f5622b737c337 /src/transport | |
| parent | 601d7a6ca95678613ca576258314f50a6e5e742c (diff) | |
| download | nng-a2801adffebb6a3679e41789b38ba925ed32832b.tar.gz nng-a2801adffebb6a3679e41789b38ba925ed32832b.tar.bz2 nng-a2801adffebb6a3679e41789b38ba925ed32832b.zip | |
Message API was awkward.
The use of a single function to get both size and length actually
turned out to be awkward to use; better to have separate functions
to get each. While here, disable some of the initialization/fork
checks, because it turns out they aren't needed.
Diffstat (limited to 'src/transport')
| -rw-r--r-- | src/transport/inproc/inproc.c | 5 | ||||
| -rw-r--r-- | src/transport/tcp/tcp.c | 11 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/transport/inproc/inproc.c b/src/transport/inproc/inproc.c index 530e7ccf..df9c9aa9 100644 --- a/src/transport/inproc/inproc.c +++ b/src/transport/inproc/inproc.c @@ -137,12 +137,13 @@ nni_inproc_pipe_send(void *arg, nni_msg *msg) // 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); + h = nni_msg_header(msg); + l = nni_msg_header_len(msg); if (nni_msg_prepend(msg, h, l) != 0) { nni_msg_free(msg); return (0); // Pretend we sent it. } - nni_msg_trim_header(msg, l); + nni_msg_trunc_header(msg, l); return (nni_msgq_put(pipe->wq, msg)); } diff --git a/src/transport/tcp/tcp.c b/src/transport/tcp/tcp.c index a37eab6a..b857863f 100644 --- a/src/transport/tcp/tcp.c +++ b/src/transport/tcp/tcp.c @@ -80,8 +80,10 @@ nni_tcp_pipe_send(void *arg, nni_msg *msg) iov[0].iov_buf = buf; iov[0].iov_len = sizeof (buf); - iov[1].iov_buf = nni_msg_header(msg, &iov[1].iov_len); - iov[2].iov_buf = nni_msg_body(msg, &iov[2].iov_len); + iov[1].iov_buf = nni_msg_header(msg); + iov[1].iov_len = nni_msg_header_len(msg); + iov[2].iov_buf = nni_msg_body(msg); + iov[2].iov_len = nni_msg_len(msg); len = (uint64_t) iov[1].iov_len + (uint64_t) iov[2].iov_len; NNI_PUT64(buf, len); @@ -102,7 +104,6 @@ nni_tcp_pipe_recv(void *arg, nni_msg **msgp) uint8_t buf[sizeof (len)]; nni_iov iov[1]; int rv; - size_t sz; iov[0].iov_buf = buf; iov[0].iov_len = sizeof (buf); @@ -118,8 +119,8 @@ nni_tcp_pipe_recv(void *arg, nni_msg **msgp) return (rv); } - iov[0].iov_len = len; - iov[0].iov_buf = nng_msg_body(msg, &sz); + iov[0].iov_len = nng_msg_len(msg); + iov[0].iov_buf = nng_msg_body(msg); if ((rv = nni_plat_tcp_recv(&pipe->fd, iov, 1)) == 0) { *msgp = msg; |
