From: W.C.A. Wijngaards Date: Mon, 6 Nov 2023 10:17:38 +0000 (+0100) Subject: - fast-reload, set nonblocking communication to keep the server thread X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6b00fd4cff6b4906eba6adb8354c675475711146;p=thirdparty%2Funbound.git - fast-reload, set nonblocking communication to keep the server thread responding to DNS requests. --- diff --git a/daemon/remote.c b/daemon/remote.c index fdb8e1641..abc95e17b 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -3670,6 +3670,13 @@ fast_reload_thread_start(RES* ssl, struct worker* worker, struct rc_state* s) #ifndef THREADS_DISABLED /* Setup command listener in remote servicing thread */ + /* The listener has to be nonblocking, so the the remote servicing + * thread can continue to service DNS queries, the fast reload + * thread is going to read the config from disk and apply it. */ + /* The commpair[1] element can stay blocking, it is used by the + * fast reload thread to communicate back. The thread needs to wait + * at these times, when it has to check briefly it can use poll. */ + fd_set_nonblock(worker->daemon->fast_reload_thread->commpair[0]); worker->daemon->fast_reload_thread->service_event = ub_event_new( comm_base_internal(worker->base), worker->daemon->fast_reload_thread->commpair[0], @@ -3694,6 +3701,10 @@ fast_reload_thread_start(RES* ssl, struct worker* worker, struct rc_state* s) log_assert(s); state_list_remove_elem(&s->rc->busy_list, s->c); s->rc->active --; + /* Set the comm point file descriptor to nonblocking. So that + * printout to the remote control client does not block the + * server thread from servicing DNS queries. */ + fd_set_nonblock(s->c->fd); worker->daemon->fast_reload_thread->client_cp = s->c; worker->daemon->fast_reload_thread->client_cp->callback = fast_reload_client_callback;