From cc2d0df91a9ac4b66710f9526953706f0ec3c672 Mon Sep 17 00:00:00 2001 From: mjpt777 Date: Fri, 17 Jan 2025 10:03:14 +0000 Subject: [PATCH] [C/C++] Change interval of driver keepalive error reporting. --- aeron-client/src/main/c/aeron_client_conductor.c | 6 +----- aeron-client/src/main/cpp/ClientConductor.h | 10 ++++------ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/aeron-client/src/main/c/aeron_client_conductor.c b/aeron-client/src/main/c/aeron_client_conductor.c index 9e03b1309b..17ac1bcbf1 100644 --- a/aeron-client/src/main/c/aeron_client_conductor.c +++ b/aeron-client/src/main/c/aeron_client_conductor.c @@ -419,11 +419,8 @@ int aeron_client_conductor_check_liveness(aeron_client_conductor_t *conductor, l aeron_client_conductor_force_close_resources(conductor); snprintf(buffer, sizeof(buffer) - 1, "MediaDriver has been shutdown"); conductor->error_handler(conductor->error_handler_clientd, AERON_CLIENT_ERROR_DRIVER_TIMEOUT, buffer); - - return -1; } - - if (now_ms > (last_keepalive_ms + (long long)conductor->driver_timeout_ms)) + else if (now_ms > (last_keepalive_ms + (long long)conductor->driver_timeout_ms)) { char buffer[AERON_ERROR_MAX_TOTAL_LENGTH]; @@ -434,7 +431,6 @@ int aeron_client_conductor_check_liveness(aeron_client_conductor_t *conductor, l (int64_t)(now_ms - last_keepalive_ms), (int64_t)conductor->driver_timeout_ms); conductor->error_handler(conductor->error_handler_clientd, AERON_CLIENT_ERROR_DRIVER_TIMEOUT, buffer); - return -1; } if (AERON_NULL_COUNTER_ID == conductor->heartbeat_timestamp.counter_id) diff --git a/aeron-client/src/main/cpp/ClientConductor.h b/aeron-client/src/main/cpp/ClientConductor.h index 02f573688f..fcf1180fda 100644 --- a/aeron-client/src/main/cpp/ClientConductor.h +++ b/aeron-client/src/main/cpp/ClientConductor.h @@ -450,13 +450,13 @@ class CLIENT_EXPORT ClientConductor if (nowMs > (m_timeOfLastKeepaliveMs + KEEPALIVE_TIMEOUT_MS)) { - int64_t lastKeepaliveMs = m_driverProxy.timeOfLastDriverKeepalive(); - if (nowMs > (lastKeepaliveMs + m_driverTimeoutMs)) + int64_t lastDriverKeepaliveMs = m_driverProxy.timeOfLastDriverKeepalive(); + if (nowMs > (lastDriverKeepaliveMs + m_driverTimeoutMs)) { m_driverActive = false; closeAllResources(nowMs); - if (NULL_VALUE == lastKeepaliveMs) + if (NULL_VALUE == lastDriverKeepaliveMs) { DriverTimeoutException exception("MediaDriver has been shutdown", SOURCEINFO); m_errorHandler(exception); @@ -464,12 +464,10 @@ class CLIENT_EXPORT ClientConductor else { DriverTimeoutException exception( - "MediaDriver keepalive: age=" + std::to_string(nowMs - lastKeepaliveMs) + + "MediaDriver keepalive: age=" + std::to_string(nowMs - lastDriverKeepaliveMs) + "ms > timeout=" + std::to_string(m_driverTimeoutMs) + "ms", SOURCEINFO); m_errorHandler(exception); } - - return 1; } if (m_heartbeatTimestamp)