From 750426037d7cd1fd0aa14966a58f9b9b501563d5 Mon Sep 17 00:00:00 2001 From: "Bruno D. Rodrigues" Date: Sun, 10 Nov 2013 10:19:19 +0000 Subject: [PATCH] Fix socket creation above sistem limits for all 'other' OS not covered by eventfd, windows or vms; enhanced test to create sockets up to a bigger limit to really test hitting the OS limit --- src/signaler.cpp | 2 +- tests/test_many_sockets.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/signaler.cpp b/src/signaler.cpp index 4b13329b..cc6c1a63 100644 --- a/src/signaler.cpp +++ b/src/signaler.cpp @@ -474,7 +474,7 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_) int rc = socketpair (AF_UNIX, SOCK_STREAM, 0, sv); if (rc == -1) { errno_assert (errno == ENFILE || errno == EMFILE); - sv [0] = sv [1] = -1; + *w_ = *r_ = -1; return -1; } else { diff --git a/tests/test_many_sockets.cpp b/tests/test_many_sockets.cpp index d7d85d7e..c910eb38 100644 --- a/tests/test_many_sockets.cpp +++ b/tests/test_many_sockets.cpp @@ -22,13 +22,14 @@ #include #include -const int no_of_sockets = 5000; +const int no_of_sockets = 2 * 65536; int main(void) { setup_test_environment(); void *ctx = zmq_ctx_new(); + zmq_ctx_set(ctx, ZMQ_MAX_SOCKETS, no_of_sockets); void *sockets[no_of_sockets]; int sockets_created = 0;