Commit 2f6af6d4 authored by Witold Krecicki's avatar Witold Krecicki

netmgr: don't issue a callback on an empty tcphandle.

If tcphandle is NULL we are closing the socket, there are no
active handles, don't issue a callback then.
parent c99381ce
Pipeline #47736 failed with stages
in 78 minutes and 3 seconds
......@@ -1166,6 +1166,10 @@ nmhandle_deactivate(isc_nmsocket_t *sock, isc_nmhandle_t *handle) {
*/
LOCK(&sock->lock);
if (sock->tcphandle == handle) {
sock->tcphandle = NULL;
}
INSIST(sock->ah_handles[handle->ah_pos] == handle);
INSIST(sock->ah_size > handle->ah_pos);
INSIST(atomic_load(&sock->ah) > 0);
......
......@@ -590,7 +590,7 @@ readtimeout_cb(uv_timer_t *handle) {
if (sock->quota) {
isc_quota_detach(&sock->quota);
}
if (sock->rcb.recv != NULL) {
if (sock->rcb.recv != NULL && sock->tcphandle != NULL) {
sock->rcb.recv(sock->tcphandle, ISC_R_TIMEDOUT, NULL,
sock->rcbarg);
isc__nmsocket_clearcb(sock);
......@@ -728,7 +728,7 @@ read_cb(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) {
isc_region_t region = { .base = (unsigned char *)buf->base,
.length = nread };
if (sock->rcb.recv != NULL) {
if (sock->rcb.recv != NULL && sock->tcphandle != NULL) {
sock->rcb.recv(sock->tcphandle, ISC_R_SUCCESS, &region,
sock->rcbarg);
}
......@@ -753,7 +753,7 @@ read_cb(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) {
* This might happen if the inner socket is closing. It means that
* it's detached, so the socket will be closed.
*/
if (sock->rcb.recv != NULL) {
if (sock->rcb.recv != NULL && sock->tcphandle != NULL) {
isc__nm_incstats(sock->mgr, sock->statsindex[STATID_RECVFAIL]);
sock->rcb.recv(sock->tcphandle, ISC_R_EOF, NULL, sock->rcbarg);
isc__nmsocket_clearcb(sock);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment