Commit e56f6980 authored by Martin Hurton's avatar Martin Hurton

choose_io_thread: do not assert when no I/O thread was chosen

parent f944336e
......@@ -278,18 +278,17 @@ zmq::io_thread_t *zmq::ctx_t::choose_io_thread (uint64_t affinity_)
// Find the I/O thread with minimum load.
int min_load = -1;
io_threads_t::size_type result = 0;
io_thread_t *selected_io_thread = NULL;
for (io_threads_t::size_type i = 0; i != io_threads.size (); i++) {
if (!affinity_ || (affinity_ & (uint64_t (1) << i))) {
int load = io_threads [i]->get_load ();
if (min_load == -1 || load < min_load) {
if (selected_io_thread == NULL || load < min_load) {
min_load = load;
result = i;
selected_io_thread = io_threads [i];
}
}
}
zmq_assert (min_load != -1);
return io_threads [result];
return selected_io_thread;
}
int zmq::ctx_t::register_endpoint (const char *addr_, endpoint_t &endpoint_)
......
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