aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-05-07 14:58:07 -0700
committerGarrett D'Amore <garrett@damore.org>2018-05-07 17:39:03 -0700
commite89202c83138bbc6bad1d5c5dcf55e00c0ee1800 (patch)
tree58f3e2bc5e824c34a6954dc6276bd77725794b69 /src
parentd066d6d4307371f3bea1134a694dba18c381f564 (diff)
downloadnng-e89202c83138bbc6bad1d5c5dcf55e00c0ee1800.tar.gz
nng-e89202c83138bbc6bad1d5c5dcf55e00c0ee1800.tar.bz2
nng-e89202c83138bbc6bad1d5c5dcf55e00c0ee1800.zip
fixes #413 desire --count option for nngcat
fixes #249 nngcat needs test cases fixes #416 transports do not permit unlimited message size with 0 fixes #417 nngcat truncates input files to 4k fixes #348 nngcat should have switch to adjust maximum receive size
Diffstat (limited to 'src')
-rw-r--r--src/transport/ipc/ipc.c2
-rw-r--r--src/transport/tcp/tcp.c2
-rw-r--r--src/transport/tls/tls.c2
-rw-r--r--src/transport/zerotier/zerotier.c3
4 files changed, 5 insertions, 4 deletions
diff --git a/src/transport/ipc/ipc.c b/src/transport/ipc/ipc.c
index e5f3d533..c91606c6 100644
--- a/src/transport/ipc/ipc.c
+++ b/src/transport/ipc/ipc.c
@@ -302,7 +302,7 @@ nni_ipc_pipe_recv_cb(void *arg)
// Make sure the message payload is not too big. If it is
// the caller will shut down the pipe.
- if (len > pipe->rcvmax) {
+ if ((len > pipe->rcvmax) && (pipe->rcvmax > 0)) {
rv = NNG_EMSGSIZE;
goto recv_error;
}
diff --git a/src/transport/tcp/tcp.c b/src/transport/tcp/tcp.c
index d7920f72..3d738a98 100644
--- a/src/transport/tcp/tcp.c
+++ b/src/transport/tcp/tcp.c
@@ -299,7 +299,7 @@ nni_tcp_pipe_recv_cb(void *arg)
// Make sure the message payload is not too big. If it is
// the caller will shut down the pipe.
- if (len > p->rcvmax) {
+ if ((len > p->rcvmax) && (p->rcvmax > 0)) {
rv = NNG_EMSGSIZE;
goto recv_error;
}
diff --git a/src/transport/tls/tls.c b/src/transport/tls/tls.c
index 73d1a29b..78fdd622 100644
--- a/src/transport/tls/tls.c
+++ b/src/transport/tls/tls.c
@@ -307,7 +307,7 @@ nni_tls_pipe_recv_cb(void *arg)
// Make sure the message payload is not too big. If it is
// the caller will shut down the pipe.
- if (len > p->rcvmax) {
+ if ((len > p->rcvmax) && (p->rcvmax > 0)) {
rv = NNG_EMSGSIZE;
goto recv_error;
}
diff --git a/src/transport/zerotier/zerotier.c b/src/transport/zerotier/zerotier.c
index 05866cfb..73cddf7d 100644
--- a/src/transport/zerotier/zerotier.c
+++ b/src/transport/zerotier/zerotier.c
@@ -921,7 +921,8 @@ zt_pipe_recv_data(zt_pipe *p, const uint8_t *data, size_t len)
if (fragno == (nfrags - 1)) {
// Last frag, maybe shorten the message.
nni_msg_chop(fl->fl_msg, (fragsz - len));
- if (nni_msg_len(fl->fl_msg) > p->zp_rcvmax) {
+ if ((nni_msg_len(fl->fl_msg) > p->zp_rcvmax) &&
+ (p->zp_rcvmax > 0)) {
// Strict enforcement of max recv.
zt_fraglist_clear(fl);
// Just discard the message.