Skip to content
Snippets Groups Projects
Commit b20265a0 authored by Marek Vavruša's avatar Marek Vavruša
Browse files

server: wait for reconfiguring threads

Interface list could be changed before the threads finish reading
it. This code simply waits for the readers before publishing, but
a smarter queueing is going to be done in #239.
parent af1cfa28
No related branches found
No related tags found
No related merge requests found
......@@ -236,6 +236,18 @@ static int reconfigure_sockets(const struct conf_t *conf, server_t *s)
}
}
/* Wait for readers that are reconfiguring right now. */
/*! \note This subsystem will be reworked in #239 */
for (unsigned proto = IO_UDP; proto <= IO_TCP; ++proto) {
dt_unit_t *tu = s->handler[proto].unit;
iohandler_t *ioh = &s->handler[proto];
for (unsigned i = 0; i < tu->size; ++i) {
while (ioh->thread_state[i] & ServerReload) {
sleep(1);
}
}
}
/* Publish new list. */
s->ifaces = newlist;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment