mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 05:28:00 +00:00
Rename sock->timer to sock->read_timer
Before adding the write timer, we have to remove the generic sock->timer to sock->read_timer. We don't touch the function names to limit the impact of the refactoring.
This commit is contained in:
parent
92338f2e29
commit
45a73c113f
@ -950,7 +950,7 @@ struct isc_nmsocket {
|
||||
/*%
|
||||
* TCP read/connect timeout timers.
|
||||
*/
|
||||
uv_timer_t timer;
|
||||
uv_timer_t read_timer;
|
||||
uint64_t read_timeout;
|
||||
uint64_t connect_timeout;
|
||||
|
||||
|
@ -1977,7 +1977,7 @@ isc__nm_failed_connect_cb(isc_nmsocket_t *sock, isc__nm_uvreq_t *req,
|
||||
REQUIRE(req->cb.connect != NULL);
|
||||
|
||||
isc__nmsocket_timer_stop(sock);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, sock);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer, sock);
|
||||
|
||||
INSIST(atomic_compare_exchange_strong(&sock->connecting,
|
||||
&(bool){ true }, false));
|
||||
@ -2108,7 +2108,7 @@ isc__nmsocket_timer_restart(isc_nmsocket_t *sock) {
|
||||
return;
|
||||
}
|
||||
|
||||
r = uv_timer_start(&sock->timer,
|
||||
r = uv_timer_start(&sock->read_timer,
|
||||
isc__nmsocket_connecttimeout_cb,
|
||||
sock->connect_timeout + 10, 0);
|
||||
UV_RUNTIME_CHECK(uv_timer_start, r);
|
||||
@ -2120,7 +2120,8 @@ isc__nmsocket_timer_restart(isc_nmsocket_t *sock) {
|
||||
return;
|
||||
}
|
||||
|
||||
r = uv_timer_start(&sock->timer, isc__nmsocket_readtimeout_cb,
|
||||
r = uv_timer_start(&sock->read_timer,
|
||||
isc__nmsocket_readtimeout_cb,
|
||||
sock->read_timeout, 0);
|
||||
UV_RUNTIME_CHECK(uv_timer_start, r);
|
||||
}
|
||||
@ -2130,7 +2131,7 @@ bool
|
||||
isc__nmsocket_timer_running(isc_nmsocket_t *sock) {
|
||||
REQUIRE(VALID_NMSOCK(sock));
|
||||
|
||||
return (uv_is_active((uv_handle_t *)&sock->timer));
|
||||
return (uv_is_active((uv_handle_t *)&sock->read_timer));
|
||||
}
|
||||
|
||||
void
|
||||
@ -2152,7 +2153,7 @@ isc__nmsocket_timer_stop(isc_nmsocket_t *sock) {
|
||||
|
||||
/* uv_timer_stop() is idempotent, no need to check if running */
|
||||
|
||||
r = uv_timer_stop(&sock->timer);
|
||||
r = uv_timer_stop(&sock->read_timer);
|
||||
UV_RUNTIME_CHECK(uv_timer_stop, r);
|
||||
}
|
||||
|
||||
@ -2404,7 +2405,7 @@ isc_nmhandle_cleartimeout(isc_nmhandle_t *handle) {
|
||||
default:
|
||||
handle->sock->read_timeout = 0;
|
||||
|
||||
if (uv_is_active((uv_handle_t *)&handle->sock->timer)) {
|
||||
if (uv_is_active((uv_handle_t *)&handle->sock->read_timer)) {
|
||||
isc__nmsocket_timer_stop(handle->sock);
|
||||
}
|
||||
}
|
||||
|
@ -140,8 +140,9 @@ tcp_connect_direct(isc_nmsocket_t *sock, isc__nm_uvreq_t *req) {
|
||||
UV_RUNTIME_CHECK(uv_tcp_init, r);
|
||||
uv_handle_set_data(&sock->uv_handle.handle, sock);
|
||||
|
||||
r = uv_timer_init(&worker->loop, &sock->timer);
|
||||
r = uv_timer_init(&worker->loop, &sock->read_timer);
|
||||
UV_RUNTIME_CHECK(uv_timer_init, r);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer, sock);
|
||||
|
||||
r = uv_tcp_open(&sock->uv_handle.tcp, sock->fd);
|
||||
if (r != 0) {
|
||||
@ -170,7 +171,8 @@ tcp_connect_direct(isc_nmsocket_t *sock, isc__nm_uvreq_t *req) {
|
||||
}
|
||||
isc__nm_incstats(sock, STATID_CONNECT);
|
||||
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, &req->uv_req.connect);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer,
|
||||
&req->uv_req.connect);
|
||||
isc__nmsocket_timer_start(sock);
|
||||
|
||||
atomic_store(&sock->connected, true);
|
||||
@ -231,7 +233,7 @@ tcp_connect_cb(uv_connect_t *uvreq, int status) {
|
||||
REQUIRE(sock->tid == isc_nm_tid());
|
||||
|
||||
isc__nmsocket_timer_stop(sock);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, sock);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer, sock);
|
||||
|
||||
if (!atomic_load(&sock->connecting)) {
|
||||
return;
|
||||
@ -527,10 +529,9 @@ isc__nm_async_tcplisten(isc__networker_t *worker, isc__netievent_t *ev0) {
|
||||
/* This keeps the socket alive after everything else is gone */
|
||||
isc__nmsocket_attach(sock, &(isc_nmsocket_t *){ NULL });
|
||||
|
||||
r = uv_timer_init(&worker->loop, &sock->timer);
|
||||
r = uv_timer_init(&worker->loop, &sock->read_timer);
|
||||
UV_RUNTIME_CHECK(uv_timer_init, r);
|
||||
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, sock);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer, sock);
|
||||
|
||||
LOCK(&sock->parent->lock);
|
||||
|
||||
@ -974,9 +975,9 @@ accept_connection(isc_nmsocket_t *ssock, isc_quota_t *quota) {
|
||||
UV_RUNTIME_CHECK(uv_tcp_init, r);
|
||||
uv_handle_set_data(&csock->uv_handle.handle, csock);
|
||||
|
||||
r = uv_timer_init(&worker->loop, &csock->timer);
|
||||
r = uv_timer_init(&worker->loop, &csock->read_timer);
|
||||
UV_RUNTIME_CHECK(uv_timer_init, r);
|
||||
uv_handle_set_data((uv_handle_t *)&csock->timer, csock);
|
||||
uv_handle_set_data((uv_handle_t *)&csock->read_timer, csock);
|
||||
|
||||
r = uv_accept(&ssock->uv_handle.stream, &csock->uv_handle.stream);
|
||||
if (r != 0) {
|
||||
@ -1278,8 +1279,8 @@ tcp_close_direct(isc_nmsocket_t *sock) {
|
||||
isc__nmsocket_timer_stop(sock);
|
||||
isc__nm_stop_reading(sock);
|
||||
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, sock);
|
||||
uv_close((uv_handle_t *)&sock->timer, timer_close_cb);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer, sock);
|
||||
uv_close((uv_handle_t *)&sock->read_timer, timer_close_cb);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1401,7 +1402,7 @@ isc__nm_async_tcpcancel(isc__networker_t *worker, isc__netievent_t *ev0) {
|
||||
REQUIRE(sock->tid == isc_nm_tid());
|
||||
UNUSED(worker);
|
||||
|
||||
uv_timer_stop(&sock->timer);
|
||||
uv_timer_stop(&sock->read_timer);
|
||||
|
||||
isc__nm_tcp_failed_read_cb(sock, ISC_R_EOF);
|
||||
}
|
||||
|
@ -105,8 +105,9 @@ tcpdns_connect_direct(isc_nmsocket_t *sock, isc__nm_uvreq_t *req) {
|
||||
UV_RUNTIME_CHECK(uv_tcp_init, r);
|
||||
uv_handle_set_data(&sock->uv_handle.handle, sock);
|
||||
|
||||
r = uv_timer_init(&worker->loop, &sock->timer);
|
||||
r = uv_timer_init(&worker->loop, &sock->read_timer);
|
||||
UV_RUNTIME_CHECK(uv_timer_init, r);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer, sock);
|
||||
|
||||
if (isc__nm_closing(sock)) {
|
||||
result = ISC_R_SHUTTINGDOWN;
|
||||
@ -144,7 +145,8 @@ tcpdns_connect_direct(isc_nmsocket_t *sock, isc__nm_uvreq_t *req) {
|
||||
}
|
||||
isc__nm_incstats(sock, STATID_CONNECT);
|
||||
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, &req->uv_req.connect);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer,
|
||||
&req->uv_req.connect);
|
||||
isc__nmsocket_timer_start(sock);
|
||||
|
||||
atomic_store(&sock->connected, true);
|
||||
@ -205,7 +207,7 @@ tcpdns_connect_cb(uv_connect_t *uvreq, int status) {
|
||||
REQUIRE(sock->tid == isc_nm_tid());
|
||||
|
||||
isc__nmsocket_timer_stop(sock);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, sock);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer, sock);
|
||||
|
||||
if (!atomic_load(&sock->connecting)) {
|
||||
return;
|
||||
@ -497,9 +499,9 @@ isc__nm_async_tcpdnslisten(isc__networker_t *worker, isc__netievent_t *ev0) {
|
||||
/* This keeps the socket alive after everything else is gone */
|
||||
isc__nmsocket_attach(sock, &(isc_nmsocket_t *){ NULL });
|
||||
|
||||
r = uv_timer_init(&worker->loop, &sock->timer);
|
||||
r = uv_timer_init(&worker->loop, &sock->read_timer);
|
||||
UV_RUNTIME_CHECK(uv_timer_init, r);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, sock);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer, sock);
|
||||
|
||||
LOCK(&sock->parent->lock);
|
||||
|
||||
@ -966,9 +968,9 @@ accept_connection(isc_nmsocket_t *ssock, isc_quota_t *quota) {
|
||||
UV_RUNTIME_CHECK(uv_tcp_init, r);
|
||||
uv_handle_set_data(&csock->uv_handle.handle, csock);
|
||||
|
||||
r = uv_timer_init(&worker->loop, &csock->timer);
|
||||
r = uv_timer_init(&worker->loop, &csock->read_timer);
|
||||
UV_RUNTIME_CHECK(uv_timer_init, r);
|
||||
uv_handle_set_data((uv_handle_t *)&csock->timer, csock);
|
||||
uv_handle_set_data((uv_handle_t *)&csock->read_timer, csock);
|
||||
|
||||
r = uv_accept(&ssock->uv_handle.stream, &csock->uv_handle.stream);
|
||||
if (r != 0) {
|
||||
@ -1320,8 +1322,8 @@ tcpdns_close_direct(isc_nmsocket_t *sock) {
|
||||
isc__nmsocket_timer_stop(sock);
|
||||
isc__nm_stop_reading(sock);
|
||||
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, sock);
|
||||
uv_close((uv_handle_t *)&sock->timer, timer_close_cb);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer, sock);
|
||||
uv_close((uv_handle_t *)&sock->read_timer, timer_close_cb);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -121,9 +121,9 @@ tlsdns_connect_direct(isc_nmsocket_t *sock, isc__nm_uvreq_t *req) {
|
||||
UV_RUNTIME_CHECK(uv_tcp_init, r);
|
||||
uv_handle_set_data(&sock->uv_handle.handle, sock);
|
||||
|
||||
r = uv_timer_init(&worker->loop, &sock->timer);
|
||||
r = uv_timer_init(&worker->loop, &sock->read_timer);
|
||||
UV_RUNTIME_CHECK(uv_timer_init, r);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, sock);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer, sock);
|
||||
|
||||
if (isc__nm_closing(sock)) {
|
||||
result = ISC_R_SHUTTINGDOWN;
|
||||
@ -161,7 +161,8 @@ tlsdns_connect_direct(isc_nmsocket_t *sock, isc__nm_uvreq_t *req) {
|
||||
}
|
||||
isc__nm_incstats(sock, STATID_CONNECT);
|
||||
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, &req->uv_req.connect);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer,
|
||||
&req->uv_req.connect);
|
||||
isc__nmsocket_timer_start(sock);
|
||||
|
||||
atomic_store(&sock->connected, true);
|
||||
@ -569,9 +570,9 @@ isc__nm_async_tlsdnslisten(isc__networker_t *worker, isc__netievent_t *ev0) {
|
||||
/* This keeps the socket alive after everything else is gone */
|
||||
isc__nmsocket_attach(sock, &(isc_nmsocket_t *){ NULL });
|
||||
|
||||
r = uv_timer_init(&worker->loop, &sock->timer);
|
||||
r = uv_timer_init(&worker->loop, &sock->read_timer);
|
||||
UV_RUNTIME_CHECK(uv_timer_init, r);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, sock);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer, sock);
|
||||
|
||||
LOCK(&sock->parent->lock);
|
||||
|
||||
@ -1107,7 +1108,8 @@ tls_cycle_input(isc_nmsocket_t *sock) {
|
||||
sock->tls.pending_req = NULL;
|
||||
|
||||
isc__nmsocket_timer_stop(sock);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, sock);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer,
|
||||
sock);
|
||||
|
||||
INSIST(atomic_compare_exchange_strong(
|
||||
&sock->connecting, &(bool){ true }, false));
|
||||
@ -1476,9 +1478,9 @@ accept_connection(isc_nmsocket_t *ssock, isc_quota_t *quota) {
|
||||
UV_RUNTIME_CHECK(uv_tcp_init, r);
|
||||
uv_handle_set_data(&csock->uv_handle.handle, csock);
|
||||
|
||||
r = uv_timer_init(&worker->loop, &csock->timer);
|
||||
r = uv_timer_init(&worker->loop, &csock->read_timer);
|
||||
UV_RUNTIME_CHECK(uv_timer_init, r);
|
||||
uv_handle_set_data((uv_handle_t *)&csock->timer, csock);
|
||||
uv_handle_set_data((uv_handle_t *)&csock->read_timer, csock);
|
||||
|
||||
r = uv_accept(&ssock->uv_handle.stream, &csock->uv_handle.stream);
|
||||
if (r != 0) {
|
||||
@ -1889,8 +1891,8 @@ tlsdns_close_direct(isc_nmsocket_t *sock) {
|
||||
isc__nmsocket_timer_stop(sock);
|
||||
isc__nm_stop_reading(sock);
|
||||
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, sock);
|
||||
uv_close((uv_handle_t *)&sock->timer, timer_close_cb);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer, sock);
|
||||
uv_close((uv_handle_t *)&sock->read_timer, timer_close_cb);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -265,9 +265,9 @@ route_connect_direct(isc_nmsocket_t *sock) {
|
||||
UV_RUNTIME_CHECK(uv_udp_init, r);
|
||||
uv_handle_set_data(&sock->uv_handle.handle, sock);
|
||||
|
||||
r = uv_timer_init(&worker->loop, &sock->timer);
|
||||
r = uv_timer_init(&worker->loop, &sock->read_timer);
|
||||
UV_RUNTIME_CHECK(uv_timer_init, r);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, sock);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer, sock);
|
||||
|
||||
if (isc__nm_closing(sock)) {
|
||||
result = ISC_R_SHUTTINGDOWN;
|
||||
@ -441,9 +441,9 @@ isc__nm_async_udplisten(isc__networker_t *worker, isc__netievent_t *ev0) {
|
||||
/* This keeps the socket alive after everything else is gone */
|
||||
isc__nmsocket_attach(sock, &(isc_nmsocket_t *){ NULL });
|
||||
|
||||
r = uv_timer_init(&worker->loop, &sock->timer);
|
||||
r = uv_timer_init(&worker->loop, &sock->read_timer);
|
||||
UV_RUNTIME_CHECK(uv_timer_init, r);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, sock);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer, sock);
|
||||
|
||||
LOCK(&sock->parent->lock);
|
||||
|
||||
@ -857,9 +857,9 @@ udp_connect_direct(isc_nmsocket_t *sock, isc__nm_uvreq_t *req) {
|
||||
UV_RUNTIME_CHECK(uv_udp_init, r);
|
||||
uv_handle_set_data(&sock->uv_handle.handle, sock);
|
||||
|
||||
r = uv_timer_init(&worker->loop, &sock->timer);
|
||||
r = uv_timer_init(&worker->loop, &sock->read_timer);
|
||||
UV_RUNTIME_CHECK(uv_timer_init, r);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->timer, sock);
|
||||
uv_handle_set_data((uv_handle_t *)&sock->read_timer, sock);
|
||||
|
||||
if (isc__nm_closing(sock)) {
|
||||
result = ISC_R_SHUTTINGDOWN;
|
||||
@ -1276,7 +1276,7 @@ udp_close_direct(isc_nmsocket_t *sock) {
|
||||
REQUIRE(VALID_NMSOCK(sock));
|
||||
REQUIRE(sock->tid == isc_nm_tid());
|
||||
|
||||
uv_close((uv_handle_t *)&sock->timer, timer_close_cb);
|
||||
uv_close((uv_handle_t *)&sock->read_timer, timer_close_cb);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
x
Reference in New Issue
Block a user