]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Avoid memory copying during send in TLS stream
authorArtem Boldariev <artem@boldariev.com>
Mon, 2 Aug 2021 11:43:54 +0000 (14:43 +0300)
committerArtem Boldariev <artem@boldariev.com>
Thu, 12 Aug 2021 11:28:17 +0000 (14:28 +0300)
At least at this point doing memory copying is not required. Probably
it was a workaround for some problem in the earlier days of DoH, at
this point it appears to be a waste of CPU cycles.

lib/isc/netmgr/tlsstream.c

index f203a9491902ab25c008af72b57d9294b48d260c..f5e65e930dcf747c1d6fe5221adb98dbf48213e2 100644 (file)
@@ -676,7 +676,6 @@ isc__nm_async_tlssend(isc__networker_t *worker, isc__netievent_t *ev0) {
 
        tls_do_bio(sock, NULL, req, false);
 done:
-       isc_mem_free(sock->mgr->mctx, req->uvbuf.base);
        isc__nm_uvreq_put(&req, sock);
        return;
 }
@@ -704,9 +703,7 @@ isc__nm_tls_send(isc_nmhandle_t *handle, const isc_region_t *region,
        isc_nmhandle_attach(handle, &uvreq->handle);
        uvreq->cb.send = cb;
        uvreq->cbarg = cbarg;
-
-       uvreq->uvbuf.base = isc_mem_allocate(sock->mgr->mctx, region->length);
-       memmove(uvreq->uvbuf.base, region->base, region->length);
+       uvreq->uvbuf.base = (char *)region->base;
        uvreq->uvbuf.len = region->length;
 
        /*