ssb: Audit timer use that might cause unnecessary delays during shutdown.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 29m34s

This commit is contained in:
Cory McWilliams 2025-02-23 13:07:36 -05:00
parent bfec46673d
commit 0a6f0ed3f7

View File

@ -746,7 +746,9 @@ static bool _tf_ssb_connection_get_request_callback(
*out_name = request->name;
}
request->last_active = uv_now(connection->ssb->loop);
if (connection->flags & k_tf_ssb_connect_flag_one_shot)
if (tf_ssb_connection_is_connected(connection) && !tf_ssb_connection_is_closing(connection) && !tf_ssb_is_shutting_down(tf_ssb_connection_get_ssb(connection)))
{
if ((connection->flags & k_tf_ssb_connect_flag_one_shot))
{
uv_timer_start(&connection->activity_timer, _tf_ssb_connection_activity_timer, k_activity_timeout_ms, 0);
}
@ -754,6 +756,7 @@ static bool _tf_ssb_connection_get_request_callback(
{
uv_timer_start(&connection->ssb->request_activity_timer, _tf_ssb_request_activity_timer, k_rpc_active_ms, 0);
}
}
return true;
}
return false;
@ -799,6 +802,8 @@ void tf_ssb_connection_add_request(tf_ssb_connection_t* connection, int32_t requ
connection->requests_count++;
connection->ssb->request_count++;
}
if (tf_ssb_connection_is_connected(connection) && !tf_ssb_connection_is_closing(connection) && !tf_ssb_is_shutting_down(tf_ssb_connection_get_ssb(connection)))
{
if (connection->flags & k_tf_ssb_connect_flag_one_shot)
{
uv_timer_start(&connection->activity_timer, _tf_ssb_connection_activity_timer, k_activity_timeout_ms, 0);
@ -807,6 +812,7 @@ void tf_ssb_connection_add_request(tf_ssb_connection_t* connection, int32_t requ
{
uv_timer_start(&connection->ssb->request_activity_timer, _tf_ssb_request_activity_timer, k_rpc_active_ms, 0);
}
}
_tf_ssb_notify_connections_changed(connection->ssb, k_tf_ssb_change_update, connection);
connection->last_notified_active = now_ms;
}
@ -1997,7 +2003,7 @@ static void _tf_ssb_connection_destroy(tf_ssb_connection_t* connection, const ch
if (!connection->is_closing)
{
connection->is_closing = true;
uv_timer_start(&connection->linger_timer, _tf_ssb_connection_linger_timer, 5000, 0);
uv_timer_start(&connection->linger_timer, _tf_ssb_connection_linger_timer, ssb->shutting_down ? 0 : 5000, 0);
_tf_ssb_notify_connections_changed(ssb, k_tf_ssb_change_update, connection);
}
if (connection->connect_callback)