From a780833683ed1f5bc4a112644836973f8282434b Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Sun, 17 Oct 2010 10:23:58 +0200 Subject: ZMQ_BACKLOG socket option added. Signed-off-by: Martin Sustrik --- src/tcp_listener.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/tcp_listener.cpp') diff --git a/src/tcp_listener.cpp b/src/tcp_listener.cpp index a62bc04..3766682 100644 --- a/src/tcp_listener.cpp +++ b/src/tcp_listener.cpp @@ -42,7 +42,8 @@ zmq::tcp_listener_t::~tcp_listener_t () close (); } -int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_) +int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_, + int backlog_) { // IPC protocol is not supported on Windows platform. if (strcmp (protocol_, "tcp") != 0 ) { @@ -81,7 +82,7 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_) } // Listen for incomming connections. - rc = listen (s, 1); + rc = listen (s, backlog_); if (rc == SOCKET_ERROR) { wsa_error_to_errno (); return -1; @@ -161,7 +162,8 @@ zmq::tcp_listener_t::~tcp_listener_t () close (); } -int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_) +int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_, + int backlog_) { if (strcmp (protocol_, "tcp") == 0 ) { @@ -201,7 +203,7 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_) } // Listen for incomming connections. - rc = listen (s, tcp_connection_backlog); + rc = listen (s, backlog_); if (rc != 0) { close (); return -1; @@ -241,7 +243,7 @@ int zmq::tcp_listener_t::set_address (const char *protocol_, const char *addr_) } // Listen for incomming connections. - rc = listen (s, tcp_connection_backlog); + rc = listen (s, backlog_); if (rc != 0) { close (); return -1; -- cgit v1.2.3