|
@@ -401,6 +401,8 @@ struct totemsrp_instance {
|
|
|
|
|
|
|
|
qb_loop_timer_handle timer_orf_token_timeout;
|
|
qb_loop_timer_handle timer_orf_token_timeout;
|
|
|
|
|
|
|
|
|
|
+ qb_loop_timer_handle timer_orf_token_warning;
|
|
|
|
|
+
|
|
|
qb_loop_timer_handle timer_orf_token_retransmit_timeout;
|
|
qb_loop_timer_handle timer_orf_token_retransmit_timeout;
|
|
|
|
|
|
|
|
qb_loop_timer_handle timer_orf_token_hold_retransmit_timeout;
|
|
qb_loop_timer_handle timer_orf_token_hold_retransmit_timeout;
|
|
@@ -653,6 +655,7 @@ static void memb_merge_detect_endian_convert (
|
|
|
struct memb_merge_detect *out);
|
|
struct memb_merge_detect *out);
|
|
|
static void srp_addr_copy_endian_convert (struct srp_addr *out, const struct srp_addr *in);
|
|
static void srp_addr_copy_endian_convert (struct srp_addr *out, const struct srp_addr *in);
|
|
|
static void timer_function_orf_token_timeout (void *data);
|
|
static void timer_function_orf_token_timeout (void *data);
|
|
|
|
|
+static void timer_function_orf_token_warning (void *data);
|
|
|
static void timer_function_pause_timeout (void *data);
|
|
static void timer_function_pause_timeout (void *data);
|
|
|
static void timer_function_heartbeat_timeout (void *data);
|
|
static void timer_function_heartbeat_timeout (void *data);
|
|
|
static void timer_function_token_retransmit_timeout (void *data);
|
|
static void timer_function_token_retransmit_timeout (void *data);
|
|
@@ -883,6 +886,20 @@ int totemsrp_initialize (
|
|
|
log_printf (instance->totemsrp_log_level_debug,
|
|
log_printf (instance->totemsrp_log_level_debug,
|
|
|
"Token Timeout (%d ms) retransmit timeout (%d ms)",
|
|
"Token Timeout (%d ms) retransmit timeout (%d ms)",
|
|
|
totem_config->token_timeout, totem_config->token_retransmit_timeout);
|
|
totem_config->token_timeout, totem_config->token_retransmit_timeout);
|
|
|
|
|
+ if (totem_config->token_warning) {
|
|
|
|
|
+ uint32_t token_warning_ms = totem_config->token_warning * totem_config->token_timeout / 100;
|
|
|
|
|
+ log_printf(instance->totemsrp_log_level_debug,
|
|
|
|
|
+ "Token warning every %d ms (%d%% of Token Timeout)",
|
|
|
|
|
+ token_warning_ms, totem_config->token_warning);
|
|
|
|
|
+ if (token_warning_ms < totem_config->token_retransmit_timeout)
|
|
|
|
|
+ log_printf (LOGSYS_LEVEL_DEBUG,
|
|
|
|
|
+ "The token warning interval (%d ms) is less than the token retransmit timeout (%d ms) "
|
|
|
|
|
+ "which can lead to spurious token warnings. Consider increasing the token_warning parameter.",
|
|
|
|
|
+ token_warning_ms, totem_config->token_retransmit_timeout);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log_printf(instance->totemsrp_log_level_debug,
|
|
|
|
|
+ "Token warnings disabled");
|
|
|
|
|
+ }
|
|
|
log_printf (instance->totemsrp_log_level_debug,
|
|
log_printf (instance->totemsrp_log_level_debug,
|
|
|
"token hold (%d ms) retransmits before loss (%d retrans)",
|
|
"token hold (%d ms) retransmits before loss (%d retrans)",
|
|
|
totem_config->token_hold_timeout, totem_config->token_retransmits_before_loss_const);
|
|
totem_config->token_hold_timeout, totem_config->token_retransmits_before_loss_const);
|
|
@@ -1566,6 +1583,21 @@ static void reset_pause_timeout (struct totemsrp_instance *instance)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static void reset_token_warning (struct totemsrp_instance *instance) {
|
|
|
|
|
+ int32_t res;
|
|
|
|
|
+
|
|
|
|
|
+ qb_loop_timer_del (instance->totemsrp_poll_handle, instance->timer_orf_token_warning);
|
|
|
|
|
+ res = qb_loop_timer_add (instance->totemsrp_poll_handle,
|
|
|
|
|
+ QB_LOOP_MED,
|
|
|
|
|
+ instance->totem_config->token_warning * instance->totem_config->token_timeout / 100 * QB_TIME_NS_IN_MSEC,
|
|
|
|
|
+ (void *)instance,
|
|
|
|
|
+ timer_function_orf_token_warning,
|
|
|
|
|
+ &instance->timer_orf_token_warning);
|
|
|
|
|
+ if (res != 0) {
|
|
|
|
|
+ log_printf(instance->totemsrp_log_level_error, "reset_token_warning - qb_loop_timer_add error : %d", res);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static void reset_token_timeout (struct totemsrp_instance *instance) {
|
|
static void reset_token_timeout (struct totemsrp_instance *instance) {
|
|
|
int32_t res;
|
|
int32_t res;
|
|
|
|
|
|
|
@@ -1579,6 +1611,9 @@ static void reset_token_timeout (struct totemsrp_instance *instance) {
|
|
|
if (res != 0) {
|
|
if (res != 0) {
|
|
|
log_printf(instance->totemsrp_log_level_error, "reset_token_timeout - qb_loop_timer_add error : %d", res);
|
|
log_printf(instance->totemsrp_log_level_error, "reset_token_timeout - qb_loop_timer_add error : %d", res);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ if (instance->totem_config->token_warning)
|
|
|
|
|
+ reset_token_warning(instance);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void reset_heartbeat_timeout (struct totemsrp_instance *instance) {
|
|
static void reset_heartbeat_timeout (struct totemsrp_instance *instance) {
|
|
@@ -1597,8 +1632,15 @@ static void reset_heartbeat_timeout (struct totemsrp_instance *instance) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+static void cancel_token_warning (struct totemsrp_instance *instance) {
|
|
|
|
|
+ qb_loop_timer_del (instance->totemsrp_poll_handle, instance->timer_orf_token_warning);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static void cancel_token_timeout (struct totemsrp_instance *instance) {
|
|
static void cancel_token_timeout (struct totemsrp_instance *instance) {
|
|
|
qb_loop_timer_del (instance->totemsrp_poll_handle, instance->timer_orf_token_timeout);
|
|
qb_loop_timer_del (instance->totemsrp_poll_handle, instance->timer_orf_token_timeout);
|
|
|
|
|
+
|
|
|
|
|
+ if (instance->totem_config->token_warning)
|
|
|
|
|
+ cancel_token_warning(instance);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
static void cancel_heartbeat_timeout (struct totemsrp_instance *instance) {
|
|
static void cancel_heartbeat_timeout (struct totemsrp_instance *instance) {
|
|
@@ -1680,6 +1722,23 @@ static void memb_recovery_state_token_loss (struct totemsrp_instance *instance)
|
|
|
instance->stats.recovery_token_lost++;
|
|
instance->stats.recovery_token_lost++;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+static void timer_function_orf_token_warning (void *data)
|
|
|
|
|
+{
|
|
|
|
|
+ struct totemsrp_instance *instance = data;
|
|
|
|
|
+ uint64_t tv_diff;
|
|
|
|
|
+
|
|
|
|
|
+ /* need to protect against the case where token_warning is set to 0 dynamically */
|
|
|
|
|
+ if (instance->totem_config->token_warning) {
|
|
|
|
|
+ tv_diff = qb_util_nano_current_get () / QB_TIME_NS_IN_MSEC -
|
|
|
|
|
+ instance->stats.token[instance->stats.latest_token].rx;
|
|
|
|
|
+ log_printf (instance->totemsrp_log_level_notice,
|
|
|
|
|
+ "Token has not been received in %d ms ", (unsigned int) tv_diff);
|
|
|
|
|
+ reset_token_warning(instance);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ cancel_token_warning(instance);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static void timer_function_orf_token_timeout (void *data)
|
|
static void timer_function_orf_token_timeout (void *data)
|
|
|
{
|
|
{
|
|
|
struct totemsrp_instance *instance = data;
|
|
struct totemsrp_instance *instance = data;
|