2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

Accept overquota TCP connection on local thread if possible

If the quota callback is called on a thread matching the socket, call
the TCP accept function directly instead of using isc_async_run() which
allocates-deallocates memory.
This commit is contained in:
Ondřej Surý 2023-04-08 13:54:52 +02:00
parent 0a468e7c9e
commit d27f6f2d68
No known key found for this signature in database
GPG Key ID: 2820F37E873DEA41

View File

@ -865,8 +865,15 @@ quota_accept_cb(isc_quota_t *quota, void *arg) {
* This needs to be asynchronous, because the quota might have been * This needs to be asynchronous, because the quota might have been
* released by a different child socket. * released by a different child socket.
*/ */
isc__nmsocket_attach(sock, &(isc_nmsocket_t *){ NULL }); if (sock->tid == isc_tid()) {
isc_async_run(sock->worker->loop, tcpaccept_cb, sock); isc_result_t result = accept_connection(sock);
isc__nm_accept_connection_log(sock, result,
can_log_tcp_quota());
sock->pquota = NULL;
} else {
isc__nmsocket_attach(sock, &(isc_nmsocket_t *){ NULL });
isc_async_run(sock->worker->loop, tcpaccept_cb, sock);
}
} }
static isc_result_t static isc_result_t