mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Allow listening on less than nworkers threads
For some applications, it's useful to not listen on full battery of threads. Add workers argument to all isc_nm_listen*() functions and convenience ISC_NM_LISTEN_ONE and ISC_NM_LISTEN_ALL macros.
This commit is contained in:
@@ -425,7 +425,7 @@ enqueue_stoplistening(isc_nmsocket_t *sock) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
isc_nm_listentcp(isc_nm_t *mgr, isc_sockaddr_t *iface,
|
||||
isc_nm_listentcp(isc_nm_t *mgr, uint32_t workers, isc_sockaddr_t *iface,
|
||||
isc_nm_accept_cb_t accept_cb, void *accept_cbarg, int backlog,
|
||||
isc_quota_t *quota, isc_nmsocket_t **sockp) {
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
@@ -439,7 +439,9 @@ isc_nm_listentcp(isc_nm_t *mgr, isc_sockaddr_t *iface,
|
||||
isc__nmsocket_init(sock, mgr, isc_nm_tcplistener, iface);
|
||||
|
||||
atomic_init(&sock->rchildren, 0);
|
||||
sock->nchildren = mgr->nworkers;
|
||||
sock->nchildren = (workers == ISC_NM_LISTEN_ALL)
|
||||
? (uint32_t)mgr->nworkers
|
||||
: workers;
|
||||
children_size = sock->nchildren * sizeof(sock->children[0]);
|
||||
sock->children = isc_mem_get(mgr->mctx, children_size);
|
||||
memset(sock->children, 0, children_size);
|
||||
|
Reference in New Issue
Block a user