mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-05 00:55:24 +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:
@@ -389,7 +389,7 @@ start_tcpdns_child(isc_nm_t *mgr, isc_sockaddr_t *iface, isc_nmsocket_t *sock,
|
||||
(isc__netievent_t *)ievent);
|
||||
}
|
||||
isc_result_t
|
||||
isc_nm_listentcpdns(isc_nm_t *mgr, isc_sockaddr_t *iface,
|
||||
isc_nm_listentcpdns(isc_nm_t *mgr, uint32_t workers, isc_sockaddr_t *iface,
|
||||
isc_nm_recv_cb_t recv_cb, void *recv_cbarg,
|
||||
isc_nm_accept_cb_t accept_cb, void *accept_cbarg,
|
||||
int backlog, isc_quota_t *quota, isc_nmsocket_t **sockp) {
|
||||
@@ -404,7 +404,9 @@ isc_nm_listentcpdns(isc_nm_t *mgr, isc_sockaddr_t *iface,
|
||||
isc__nmsocket_init(sock, mgr, isc_nm_tcpdnslistener, 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