mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-04 00:25:29 +00:00
TLS: expose the ability to (re)start and stop underlying read timer
This commit adds implementation of isc__nmsocket_timer_restart() and isc__nmsocket_timer_stop() for generic TLS code in order to make its interface more compatible with that of TCP.
This commit is contained in:
@@ -1586,6 +1586,12 @@ isc__nmhandle_tls_setwritetimeout(isc_nmhandle_t *handle,
|
|||||||
bool
|
bool
|
||||||
isc__nmsocket_tls_timer_running(isc_nmsocket_t *sock);
|
isc__nmsocket_tls_timer_running(isc_nmsocket_t *sock);
|
||||||
|
|
||||||
|
void
|
||||||
|
isc__nmsocket_tls_timer_restart(isc_nmsocket_t *sock);
|
||||||
|
|
||||||
|
void
|
||||||
|
isc__nmsocket_tls_timer_stop(isc_nmsocket_t *sock);
|
||||||
|
|
||||||
void
|
void
|
||||||
isc__nm_tls_failed_read_cb(isc_nmsocket_t *sock, isc_result_t result,
|
isc__nm_tls_failed_read_cb(isc_nmsocket_t *sock, isc_result_t result,
|
||||||
bool async);
|
bool async);
|
||||||
|
@@ -1511,6 +1511,16 @@ void
|
|||||||
isc__nmsocket_timer_restart(isc_nmsocket_t *sock) {
|
isc__nmsocket_timer_restart(isc_nmsocket_t *sock) {
|
||||||
REQUIRE(VALID_NMSOCK(sock));
|
REQUIRE(VALID_NMSOCK(sock));
|
||||||
|
|
||||||
|
switch (sock->type) {
|
||||||
|
#ifdef HAVE_LIBNGHTTP2
|
||||||
|
case isc_nm_tlssocket:
|
||||||
|
isc__nmsocket_tls_timer_restart(sock);
|
||||||
|
return;
|
||||||
|
#endif /* HAVE_LIBNGHTTP2 */
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (uv_is_closing((uv_handle_t *)&sock->read_timer)) {
|
if (uv_is_closing((uv_handle_t *)&sock->read_timer)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1574,6 +1584,16 @@ isc__nmsocket_timer_stop(isc_nmsocket_t *sock) {
|
|||||||
|
|
||||||
REQUIRE(VALID_NMSOCK(sock));
|
REQUIRE(VALID_NMSOCK(sock));
|
||||||
|
|
||||||
|
switch (sock->type) {
|
||||||
|
#ifdef HAVE_LIBNGHTTP2
|
||||||
|
case isc_nm_tlssocket:
|
||||||
|
isc__nmsocket_tls_timer_stop(sock);
|
||||||
|
return;
|
||||||
|
#endif /* HAVE_LIBNGHTTP2 */
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* uv_timer_stop() is idempotent, no need to check if running */
|
/* uv_timer_stop() is idempotent, no need to check if running */
|
||||||
|
|
||||||
r = uv_timer_stop(&sock->read_timer);
|
r = uv_timer_stop(&sock->read_timer);
|
||||||
|
@@ -1229,6 +1229,30 @@ isc__nmsocket_tls_timer_running(isc_nmsocket_t *sock) {
|
|||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
isc__nmsocket_tls_timer_restart(isc_nmsocket_t *sock) {
|
||||||
|
REQUIRE(VALID_NMSOCK(sock));
|
||||||
|
REQUIRE(sock->type == isc_nm_tlssocket);
|
||||||
|
|
||||||
|
if (sock->outerhandle != NULL) {
|
||||||
|
INSIST(VALID_NMHANDLE(sock->outerhandle));
|
||||||
|
REQUIRE(VALID_NMSOCK(sock->outerhandle->sock));
|
||||||
|
isc__nmsocket_timer_restart(sock->outerhandle->sock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
isc__nmsocket_tls_timer_stop(isc_nmsocket_t *sock) {
|
||||||
|
REQUIRE(VALID_NMSOCK(sock));
|
||||||
|
REQUIRE(sock->type == isc_nm_tlssocket);
|
||||||
|
|
||||||
|
if (sock->outerhandle != NULL) {
|
||||||
|
INSIST(VALID_NMHANDLE(sock->outerhandle));
|
||||||
|
REQUIRE(VALID_NMSOCK(sock->outerhandle->sock));
|
||||||
|
isc__nmsocket_timer_stop(sock->outerhandle->sock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
isc__nm_tls_verify_tls_peer_result_string(const isc_nmhandle_t *handle) {
|
isc__nm_tls_verify_tls_peer_result_string(const isc_nmhandle_t *handle) {
|
||||||
isc_nmsocket_t *sock = NULL;
|
isc_nmsocket_t *sock = NULL;
|
||||||
|
Reference in New Issue
Block a user