Problem: select blocks forever under Unix

Solution: fixed call of select, and initialization of poll_t members
This commit is contained in:
Simon Giesecke 2018-02-09 16:14:42 -05:00
parent a30133d8f5
commit 08201bc1b9
2 changed files with 7 additions and 12 deletions

View File

@ -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 ();

View File

@ -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.