diff --git a/src/platform/posix/posix_peerid.h b/src/platform/posix/posix_peerid.h index 9b5a24bf1..57e9abff4 100644 --- a/src/platform/posix/posix_peerid.h +++ b/src/platform/posix/posix_peerid.h @@ -19,8 +19,7 @@ #include "core/nng_impl.h" #include -int -nni_posix_peerid(int fd, - uint64_t *euid, uint64_t *egid, uint64_t *prid, uint64_t *znid); +int nni_posix_peerid( + int fd, uint64_t *euid, uint64_t *egid, uint64_t *prid, uint64_t *znid); #endif // PLATFORM_POSIX_PEERID_H \ No newline at end of file diff --git a/src/sp/transport/socket/sockfd.c b/src/sp/transport/socket/sockfd.c index 98a01d1fd..2db052acf 100644 --- a/src/sp/transport/socket/sockfd.c +++ b/src/sp/transport/socket/sockfd.c @@ -873,18 +873,8 @@ sfd_tran_ep_set_recvmaxsz(void *arg, const void *v, size_t sz, nni_opt_type t) size_t val; int rv; if ((rv = nni_copyin_size(&val, v, sz, 0, NNI_MAXSZ, t)) == 0) { - sfd_tran_pipe *p; nni_mtx_lock(&ep->mtx); ep->rcvmax = val; - NNI_LIST_FOREACH (&ep->waitpipes, p) { - p->rcvmax = val; - } - NNI_LIST_FOREACH (&ep->negopipes, p) { - p->rcvmax = val; - } - NNI_LIST_FOREACH (&ep->busypipes, p) { - p->rcvmax = val; - } nni_mtx_unlock(&ep->mtx); #ifdef NNG_ENABLE_STATS nni_stat_set_value(&ep->st_rcv_max, val); diff --git a/src/sp/transport/socket/sockfd_test.c b/src/sp/transport/socket/sockfd_test.c index bcd772165..c12d44660 100644 --- a/src/sp/transport/socket/sockfd_test.c +++ b/src/sp/transport/socket/sockfd_test.c @@ -14,6 +14,7 @@ #ifdef NNG_PLATFORM_POSIX #include +#include #ifdef NNG_PLATFORM_SUNOS #include #endif @@ -417,6 +418,25 @@ test_sfd_fd_option_type(void) NUTS_CLOSE(s); } +void +test_sfd_fd_dev_zero(void) +{ +#ifdef NNG_PLATFORM_POSIX + nng_socket s; + nng_listener l; + int fd; + + // dev/zero produces a stream of zero bytes leading to protocol error + NUTS_ASSERT((fd = open("/dev/zero", O_RDONLY, 0777)) >= 0); + + NUTS_OPEN(s); + NUTS_PASS(nng_listener_create(&l, s, "socket://")); + NUTS_PASS(nng_listener_set_int(l, NNG_OPT_SOCKET_FD, fd)); + nng_msleep(100); + NUTS_CLOSE(s); +#endif +} + NUTS_TESTS = { { "socket connect fail", test_sfd_connect_fail }, { "socket malformed address", test_sfd_malformed_address }, @@ -434,6 +454,7 @@ NUTS_TESTS = { { "socket pipe peer id", test_sockfd_pipe_peer }, { "socket listen full", test_sfd_listen_full }, { "socket bad fd type", test_sfd_fd_option_type }, + { "socket dev zero", test_sfd_fd_dev_zero }, #endif { NULL, NULL },