size_t len = 0;
bool new_send_req = false;
isc_region_t used_region = { 0 };
+ bool shutting_down = isc__nm_closing(sock->worker);
- if (inactive(sock)) {
+ if (shutting_down || inactive(sock)) {
if (cb != NULL) {
+ isc_result_t result = shutting_down ? ISC_R_SHUTTINGDOWN
+ : ISC_R_CANCELED;
INSIST(VALID_NMHANDLE(tlshandle));
- cb(tlshandle, ISC_R_CANCELED, cbarg);
+ cb(tlshandle, result, cbarg);
}
return (0);
}
REQUIRE(VALID_NMSOCK(sock));
REQUIRE(sock->tid == isc_tid());
- if (inactive(sock)) {
+ if (isc__nm_closing(sock->worker)) {
+ req->cb.send(req->handle, ISC_R_SHUTTINGDOWN, req->cbarg);
+ goto done;
+ } else if (inactive(sock)) {
req->cb.send(req->handle, ISC_R_CANCELED, req->cbarg);
goto done;
}
REQUIRE(sock->statichandle == handle);
REQUIRE(sock->tid == isc_tid());
- if (inactive(sock)) {
+ if (isc__nm_closing(sock->worker)) {
+ cb(handle, ISC_R_SHUTTINGDOWN, NULL, cbarg);
+ return;
+ } else if (inactive(sock)) {
cb(handle, ISC_R_CANCELED, NULL, cbarg);
return;
}
if (isc__nm_closing(worker)) {
result = ISC_R_SHUTTINGDOWN;
goto error;
+ } else if (isc__nmsocket_closing(handle->sock)) {
+ result = ISC_R_CANCELED;
+ goto error;
}
/*