From 08201bc1b941f1e2cbd1767f652335ae84930401 Mon Sep 17 00:00:00 2001 From: Simon Giesecke Date: Fri, 9 Feb 2018 16:14:42 -0500 Subject: [PATCH] Problem: select blocks forever under Unix Solution: fixed call of select, and initialization of poll_t members --- src/select.cpp | 14 +++++++------- src/select.hpp | 5 ----- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/select.cpp b/src/select.cpp index 4b8f5b7d..2bc8bcbf 100644 --- a/src/select.cpp +++ b/src/select.cpp @@ -189,9 +189,9 @@ int zmq::select_t::try_retire_fd_entry ( void zmq::select_t::rm_fd (handle_t handle_) { + int retired = 0; #if defined ZMQ_HAVE_WINDOWS u_short family = get_fd_family (handle_); - int retired = 0; if (family != AF_UNSPEC) { family_entries_t::iterator family_entry_it = family_entries.find (family); @@ -411,7 +411,7 @@ void zmq::select_t::loop () } } #else - select_family_entry (family_entry, maxfd, timeout > 0, tv); + select_family_entry (family_entry, maxfd + 1, timeout > 0, tv); #endif } zmq_stopwatch_stop (stopwatch); @@ -523,6 +523,11 @@ bool zmq::select_t::is_retired_fd (const fd_entry_t &entry) return (entry.fd == retired_fd); } +zmq::select_t::family_entry_t::family_entry_t () : has_retired (false) +{ +} + + #if defined ZMQ_HAVE_WINDOWS u_short zmq::select_t::get_fd_family (fd_t fd_) { @@ -579,11 +584,6 @@ u_short zmq::select_t::determine_fd_family (fd_t fd_) return AF_UNSPEC; } -zmq::select_t::family_entry_t::family_entry_t () : has_retired (false) -{ -} - - zmq::select_t::wsa_events_t::wsa_events_t () { events[0] = WSACreateEvent (); diff --git a/src/select.hpp b/src/select.hpp index 2b041fb6..b727ebe8 100644 --- a/src/select.hpp +++ b/src/select.hpp @@ -115,11 +115,7 @@ class select_t : public poller_base_t struct family_entry_t { -#ifndef ZMQ_HAVE_WINDOWS - family_entry_t () {}; -#else family_entry_t (); -#endif fd_entries_t fd_entries; fds_set_t fds_set; @@ -161,7 +157,6 @@ class select_t : public poller_base_t // on non-Windows, we can treat all fds as one family family_entry_t family_entry; fd_t maxfd; - bool retired; #endif // Checks if an fd_entry_t is retired.