2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

Update netmgr, tasks, and applications to use isc_loopmgr

Previously:

* applications were using isc_app as the base unit for running the
  application and signal handling.

* networking was handled in the netmgr layer, which would start a
  number of threads, each with a uv_loop event loop.

* task/event handling was done in the isc_task unit, which used
  netmgr event loops to run the isc_event calls.

In this refactoring:

* the network manager now uses isc_loop instead of maintaining its
  own worker threads and event loops.

* the taskmgr that manages isc_task instances now also uses isc_loopmgr,
  and every isc_task runs on a specific isc_loop bound to the specific
  thread.

* applications have been updated as necessary to use the new API.

* new ISC_LOOP_TEST macros have been added to enable unit tests to
  run isc_loop event loops. unit tests have been updated to use this
  where needed.
This commit is contained in:
Ondřej Surý
2022-07-26 13:03:45 +02:00
parent 49b149f5fd
commit b69e783164
90 changed files with 4056 additions and 6642 deletions

View File

@@ -25,8 +25,8 @@
#include <string.h>
#include <unistd.h>
#include <isc/app.h>
#include <isc/condition.h>
#include <isc/loop.h>
#include <isc/mutex.h>
#include <isc/thread.h>
#include <isc/util.h>
@@ -126,7 +126,7 @@ fuzz_thread_client(void *arg) {
close(sockfd);
named_server_flushonshutdown(named_g_server,
false);
isc_app_shutdown();
isc_loopmgr_shutdown(named_g_loopmgr);
return (NULL);
}
raise(SIGSTOP);
@@ -159,7 +159,7 @@ fuzz_thread_client(void *arg) {
close(sockfd);
named_server_flushonshutdown(named_g_server, false);
isc_app_shutdown();
isc_loopmgr_shutdown(named_g_loopmgr);
return (NULL);
}
@@ -374,7 +374,7 @@ fuzz_thread_resolver(void *arg) {
close(listenfd);
named_server_flushonshutdown(named_g_server,
false);
isc_app_shutdown();
isc_loopmgr_shutdown(named_g_loopmgr);
return (NULL);
}
raise(SIGSTOP);
@@ -574,7 +574,7 @@ fuzz_thread_resolver(void *arg) {
close(sockfd);
close(listenfd);
named_server_flushonshutdown(named_g_server, false);
isc_app_shutdown();
isc_loopmgr_shutdown(named_g_loopmgr);
#ifdef __AFL_LOOP
/*
@@ -716,7 +716,7 @@ fuzz_thread_tcp(void *arg) {
free(buf);
close(sockfd);
named_server_flushonshutdown(named_g_server, false);
isc_app_shutdown();
isc_loopmgr_shutdown(named_g_loopmgr);
return (NULL);
}
@@ -733,7 +733,7 @@ named_fuzz_notify(void) {
#ifdef ENABLE_AFL
if (getenv("AFL_CMIN")) {
named_server_flushonshutdown(named_g_server, false);
isc_app_shutdown();
isc_loopmgr_shutdown(named_g_loopmgr);
return;
}