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

Make the netmgr send callback to be asynchronous only when needed

Previously, the send callback would be synchronous only on success.  Add
an option (similar to what other callbacks have) to decide whether we
need the asynchronous send callback on a higher level.

On a general level, we need the asynchronous callbacks to happen only
when we are invoking the callback from the public API.  If the path to
the callback went through the libuv callback or netmgr callback, we are
already on asynchronous path, and there's no need to make the call to
the callback asynchronous again.

For the send callback, this means we need the asynchronous path for
failure paths inside the isc_nm_send() (which calls isc__nm_udp_send(),
isc__nm_tcp_send(), etc...) - all other invocations of the send callback
could be synchronous, because those are called from the respective libuv
send callbacks.
This commit is contained in:
Ondřej Surý
2022-11-24 17:11:22 +01:00
parent 5ca49942a3
commit f3004da3a5
6 changed files with 14 additions and 10 deletions

View File

@@ -1324,12 +1324,12 @@ isc__nm_alloc_dnsbuf(isc_nmsocket_t *sock, size_t len) {
void
isc__nm_failed_send_cb(isc_nmsocket_t *sock, isc__nm_uvreq_t *req,
isc_result_t eresult) {
isc_result_t eresult, bool async) {
REQUIRE(VALID_NMSOCK(sock));
REQUIRE(VALID_UVREQ(req));
if (req->cb.send != NULL) {
isc__nm_sendcb(sock, req, eresult, true);
isc__nm_sendcb(sock, req, eresult, async);
} else {
isc__nm_uvreq_put(&req, sock);
}