From: Artem Boldariev Date: Tue, 26 Sep 2023 12:37:48 +0000 (+0300) Subject: Add a utility function to dump all active sockets on a NM instance X-Git-Tag: v9.19.19~10^2~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3c45dd59cb17ef08b6276c6f29488d5b50d4c193;p=thirdparty%2Fbind9.git Add a utility function to dump all active sockets on a NM instance Add the new isc__nm_dump_active_manager() function that can be used for debugging purposes: it dumps all active sockets withing the network manager instance. --- diff --git a/lib/isc/netmgr/netmgr-int.h b/lib/isc/netmgr/netmgr-int.h index 9d8f642eb22..71822b36411 100644 --- a/lib/isc/netmgr/netmgr-int.h +++ b/lib/isc/netmgr/netmgr-int.h @@ -215,9 +215,14 @@ typedef struct isc__networker { ISC_REFCOUNT_DECL(isc__networker); +#ifdef ISC_NETMGR_TRACE void isc__nm_dump_active(isc__networker_t *worker); +void +isc__nm_dump_active_manager(isc_nm_t *netmgr); +#endif /* ISC_NETMGR_TRACE */ + /* * A general handle for a connection bound to a networker. For UDP * connections we have peer address here, so both TCP and UDP can be diff --git a/lib/isc/netmgr/netmgr.c b/lib/isc/netmgr/netmgr.c index c02bf645af3..41541cbb28d 100644 --- a/lib/isc/netmgr/netmgr.c +++ b/lib/isc/netmgr/netmgr.c @@ -2926,4 +2926,18 @@ isc__nm_dump_active(isc__networker_t *worker) { nmsocket_dump(sock); } } + +void +isc__nm_dump_active_manager(isc_nm_t *netmgr) { + size_t i = 0; + + for (i = 0; i < netmgr->nloops; i++) { + isc__networker_t *worker = &netmgr->workers[i]; + + if (!ISC_LIST_EMPTY(worker->active_sockets)) { + fprintf(stderr, "Worker #%zu (%p)\n", i, worker); + isc__nm_dump_active(worker); + } + } +} #endif