mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Properly handle outer TCP connection closed in TCPDNS.
If the connection is closed while we're processing the request we might access TCPDNS outerhandle which is already reset. Check for this condition and call the callback with ISC_R_CANCELED result.
This commit is contained in:
parent
0241d9ddc8
commit
c41ce8e0c9
1 changed files with 10 additions and 3 deletions
|
|
@ -596,9 +596,16 @@ isc__nm_tcpdns_send(isc_nmhandle_t *handle, isc_region_t *region,
|
|||
|
||||
r.base = (unsigned char *)uvreq->uvbuf.base;
|
||||
r.length = uvreq->uvbuf.len;
|
||||
|
||||
isc_nmhandle_attach(sock->outerhandle, &sendhandle);
|
||||
isc_nm_send(sock->outerhandle, &r, tcpdnssend_cb, uvreq);
|
||||
if (sock->outerhandle != NULL) {
|
||||
isc_nmhandle_attach(sock->outerhandle, &sendhandle);
|
||||
isc_nm_send(sock->outerhandle, &r, tcpdnssend_cb,
|
||||
uvreq);
|
||||
} else {
|
||||
cb(handle, ISC_R_CANCELED, cbarg);
|
||||
isc_mem_put(sock->mgr->mctx, uvreq->uvbuf.base,
|
||||
uvreq->uvbuf.len);
|
||||
isc__nm_uvreq_put(&uvreq, sock);
|
||||
}
|
||||
} else {
|
||||
isc__netievent_tcpdnssend_t *ievent = NULL;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue