* both socket layers.
*/
+void
+isc_nmhandle_keepalive(isc_nmhandle_t *handle, bool value);
+/*%<
+ * Enable/disable keepalive on this connection by setting it to 'value'.
+ *
+ * When keepalive is active, we switch to using the keepalive timeout
+ * to determine when to close a connection, rather than the idle timeout.
+ *
+ * This applies only to TCP-based DNS connections (i.e., TCPDNS or
+ * TLSDNS). On other types of connection it has no effect.
+ */
+
isc_sockaddr_t
isc_nmhandle_peeraddr(isc_nmhandle_t *handle);
/*%<
}
}
+void
+isc_nmhandle_keepalive(isc_nmhandle_t *handle, bool value) {
+ REQUIRE(VALID_NMHANDLE(handle));
+
+ switch (handle->sock->type) {
+ case isc_nm_tcpdnssocket:
+ isc__nm_tcpdns_keepalive(handle, value);
+ break;
+ case isc_nm_tlsdnssocket:
+ isc__nm_tlsdns_keepalive(handle, value);
+ break;
+ default:
+ return;
+ }
+}
+
void *
isc_nmhandle_getextra(isc_nmhandle_t *handle) {
REQUIRE(VALID_NMHANDLE(handle));
REQUIRE(VALID_NMHANDLE(handle));
REQUIRE(VALID_NMSOCK(handle->sock));
- REQUIRE(handle->sock->type != isc_nm_tcpdnssocket);
+ REQUIRE(handle->sock->type == isc_nm_tcpdnssocket);
sock = handle->sock;
REQUIRE(VALID_NMHANDLE(handle));
REQUIRE(VALID_NMSOCK(handle->sock));
- REQUIRE(handle->sock->type != isc_nm_tlsdnssocket);
+ REQUIRE(handle->sock->type == isc_nm_tlsdnssocket);
sock = handle->sock;
}
client->attributes |=
NS_CLIENTATTR_USEKEEPALIVE;
+ isc_nmhandle_keepalive(client->handle, true);
isc_buffer_forward(&optbuf, optlen);
break;
case DNS_OPT_PAD: