From: Ondřej Surý Date: Wed, 9 Feb 2022 18:48:13 +0000 (+0100) Subject: Add isc_nmhandle_setwritetimeout() function X-Git-Tag: v9.19.0~111^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a89d9e0fa68b8d915c6a1c416543dd157d8b0b5a;p=thirdparty%2Fbind9.git Add isc_nmhandle_setwritetimeout() function In some situations (unit test and forthcoming XFR timeouts MR), we need to modify the write timeout independently of the read timeout. Add a isc_nmhandle_setwritetimeout() function that could be called before isc_nm_send() to specify a custom write timeout interval. --- diff --git a/lib/isc/include/isc/netmgr.h b/lib/isc/include/isc/netmgr.h index 6c52f638c84..671880137dd 100644 --- a/lib/isc/include/isc/netmgr.h +++ b/lib/isc/include/isc/netmgr.h @@ -697,3 +697,6 @@ isc__nm_force_tid(int tid); * Force the thread ID to 'tid'. This is STRICTLY for use in unit * tests and should not be used in any production code. */ + +void +isc_nmhandle_setwritetimeout(isc_nmhandle_t *handle, uint64_t write_timeout); diff --git a/lib/isc/netmgr/netmgr.c b/lib/isc/netmgr/netmgr.c index b63f990163f..ddcfe23276e 100644 --- a/lib/isc/netmgr/netmgr.c +++ b/lib/isc/netmgr/netmgr.c @@ -604,6 +604,14 @@ isc_nm_maxudp(isc_nm_t *mgr, uint32_t maxudp) { atomic_store(&mgr->maxudp, maxudp); } +void +isc_nmhandle_setwritetimeout(isc_nmhandle_t *handle, uint64_t write_timeout) { + REQUIRE(VALID_NMHANDLE(handle)); + REQUIRE(VALID_NMSOCK(handle->sock)); + + handle->sock->write_timeout = write_timeout; +} + void isc_nm_settimeouts(isc_nm_t *mgr, uint32_t init, uint32_t idle, uint32_t keepalive, uint32_t advertised) {