ssb: Even more muxrpc activity status fixes.
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 21m51s

This commit is contained in:
Cory McWilliams 2024-10-05 21:00:50 -04:00
parent b222dc0ca8
commit e799b256b2

View File

@ -662,28 +662,6 @@ static int _request_compare(const void* a, const void* b)
return ai < br->request_number ? -1 : br->request_number < ai ? 1 : 0;
}
static bool _tf_ssb_connection_get_request_callback(tf_ssb_connection_t* connection, int32_t request_number, tf_ssb_rpc_callback_t** out_callback, void** out_user_data)
{
if (!connection->requests)
{
return false;
}
tf_ssb_request_t* request = bsearch(&request_number, connection->requests, connection->requests_count, sizeof(tf_ssb_request_t), _request_compare);
if (request)
{
if (out_callback)
{
*out_callback = request->callback;
}
if (out_user_data)
{
*out_user_data = request->user_data;
}
return true;
}
return false;
}
static void _tf_ssb_request_activity_timer(uv_timer_t* timer)
{
tf_ssb_t* ssb = timer->data;
@ -712,12 +690,39 @@ static void _tf_ssb_request_activity_timer(uv_timer_t* timer)
}
}
if (any_still_active)
if (any_still_active && uv_timer_get_due_in(&ssb->request_activity_timer) == 0)
{
uv_timer_start(&ssb->request_activity_timer, _tf_ssb_request_activity_timer, k_rpc_active_ms, 0);
}
}
static bool _tf_ssb_connection_get_request_callback(tf_ssb_connection_t* connection, int32_t request_number, tf_ssb_rpc_callback_t** out_callback, void** out_user_data)
{
if (!connection->requests)
{
return false;
}
tf_ssb_request_t* request = bsearch(&request_number, connection->requests, connection->requests_count, sizeof(tf_ssb_request_t), _request_compare);
if (request)
{
if (out_callback)
{
*out_callback = request->callback;
}
if (out_user_data)
{
*out_user_data = request->user_data;
}
request->last_active = uv_now(connection->ssb->loop);
if (uv_timer_get_due_in(&connection->ssb->request_activity_timer) == 0)
{
uv_timer_start(&connection->ssb->request_activity_timer, _tf_ssb_request_activity_timer, k_rpc_active_ms, 0);
}
return true;
}
return false;
}
void tf_ssb_connection_add_request(tf_ssb_connection_t* connection, int32_t request_number, const char* name, tf_ssb_rpc_callback_t* callback, tf_ssb_callback_cleanup_t* cleanup,
void* user_data, tf_ssb_connection_t* dependent_connection)
{