From: Alan T. DeKok Date: Fri, 24 Jul 2020 14:55:52 +0000 (-0400) Subject: add each worker to all network threads X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0526caebdff7ed8c98d5fbe0b5877cb446cf26f0;p=thirdparty%2Ffreeradius-server.git add each worker to all network threads --- diff --git a/src/lib/io/schedule.c b/src/lib/io/schedule.c index b022ec37cf5..bf404d6d25f 100644 --- a/src/lib/io/schedule.c +++ b/src/lib/io/schedule.c @@ -218,8 +218,14 @@ static void *fr_schedule_worker_thread(void *arg) sw->status = FR_CHILD_RUNNING; - sn = fr_dlist_head(&sc->networks); - (void) fr_network_worker_add(sn->nr, sw->worker); + /* + * Add this worker to all network threads. + */ + for (sn = fr_dlist_head(&sc->networks); + sn != NULL; + sn = fr_dlist_next(&sc->networks, sn)) { + (void) fr_network_worker_add(sn->nr, sw->worker); + } DEBUG3("%s - Started", worker_name); @@ -730,9 +736,10 @@ int fr_schedule_destroy(fr_schedule_t **sc_to_free) /* * If the network threads are running, tell them to exit, - * and wait for them to do so. Once they have exited, we - * know that this thread can use the network channels to - * tell the workers that the network side is going away. + * and wait for them to do so. Each network thread tells + * all of its worker threads that it's exiting. It then + * closes the channels. When the workers see that there + * are no input channels, they exit, too. */ for (i = 0; i < (unsigned int)fr_dlist_num_elements(&sc->networks); i++) { DEBUG2("Scheduler - Waiting for semaphore indicating network exit %u/%u", i,