mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
change the signature of recv callbacks to include a result code
this will allow recv event handlers to distinguish between cases in which the region is NULL because of error, shutdown, or cancelation.
This commit is contained in:
@@ -582,7 +582,8 @@ readtimeout_cb(uv_timer_t *handle) {
|
||||
isc_quota_detach(&sock->quota);
|
||||
}
|
||||
if (sock->rcb.recv != NULL) {
|
||||
sock->rcb.recv(sock->tcphandle, NULL, sock->rcbarg);
|
||||
sock->rcb.recv(sock->tcphandle, ISC_R_TIMEDOUT, NULL,
|
||||
sock->rcbarg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -716,7 +717,8 @@ read_cb(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) {
|
||||
.length = nread };
|
||||
|
||||
if (sock->rcb.recv != NULL) {
|
||||
sock->rcb.recv(sock->tcphandle, ®ion, sock->rcbarg);
|
||||
sock->rcb.recv(sock->tcphandle, ISC_R_SUCCESS, ®ion,
|
||||
sock->rcbarg);
|
||||
}
|
||||
|
||||
sock->read_timeout = (atomic_load(&sock->keepalive)
|
||||
@@ -741,7 +743,7 @@ read_cb(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) {
|
||||
*/
|
||||
if (sock->rcb.recv != NULL) {
|
||||
isc__nm_incstats(sock->mgr, sock->statsindex[STATID_RECVFAIL]);
|
||||
sock->rcb.recv(sock->tcphandle, NULL, sock->rcbarg);
|
||||
sock->rcb.recv(sock->tcphandle, ISC_R_EOF, NULL, sock->rcbarg);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1076,7 +1078,8 @@ isc__nm_tcp_shutdown(isc_nmsocket_t *sock) {
|
||||
if (sock->type == isc_nm_tcpsocket && sock->tcphandle != NULL &&
|
||||
sock->rcb.recv != NULL)
|
||||
{
|
||||
sock->rcb.recv(sock->tcphandle, NULL, sock->rcbarg);
|
||||
sock->rcb.recv(sock->tcphandle, ISC_R_CANCELED, NULL,
|
||||
sock->rcbarg);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user