Commit 555a0877 authored by Laughing's avatar Laughing Committed by Luca Boccassi

fix bugs of the pollset (#2127)

* fix bugs of the pollset

1. extend 'fd_table' when fd_ is greater or equal than the size of 'fd_table';
2. delete specific fd from pollset before reset pollin or pollout according the description of AIX document

* fix bugs of the pollset

edit error. remove extra spaces and paste fault

* fix bugs of pollset

remove character '-' at the end line.
......@@ -81,7 +81,9 @@ zmq::pollset_t::handle_t zmq::pollset_t::add_fd (fd_t fd_, i_poll_events *events
// Increase the load metric of the thread.
adjust_load (1);
fd_table.resize(fd_ + 1, NULL);
if (fd_ >= fd_table.size ()) {
fd_table.resize(fd_ + 1, NULL);
}
fd_table [fd_] = pe;
return pe;
}
......@@ -132,16 +134,16 @@ void zmq::pollset_t::reset_pollin (handle_t handle_)
pc.fd = pe->fd;
pc.events = 0;
pc.cmd = PS_DELETE;
int rc = pollset_ctl (pollset_fd, &pc, 1);
if (pe->flag_pollout) {
pc.cmd = PS_DELETE;
pc.events = POLLOUT;
pollset_ctl(pollset_fd, &pc, 1);
pc.cmd = PS_MOD;
rc = pollset_ctl (pollset_fd, &pc, 1);
errno_assert (rc != -1);
}
pc.cmd = PS_MOD;
int rc = pollset_ctl (pollset_fd, &pc, 1);
errno_assert (rc != -1);
pe->flag_pollin = false;
}
......@@ -172,16 +174,16 @@ void zmq::pollset_t::reset_pollout (handle_t handle_)
pc.fd = pe->fd;
pc.events = 0;
pc.cmd = PS_DELETE;
int rc = pollset_ctl (pollset_fd, &pc, 1);
errno_assert (rc != -1);
if (pe->flag_pollin) {
pc.cmd = PS_DELETE;
pc.cmd = PS_MOD;
pc.events = POLLIN;
pollset_ctl (pollset_fd, &pc, 1);
rc = pollset_ctl (pollset_fd, &pc, 1);
errno_assert (rc != -1);
}
pc.cmd = PS_MOD;
int rc = pollset_ctl (pollset_fd, &pc, 1);
errno_assert (rc != -1);
pe->flag_pollout = false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment