ssb: Avoid more work on shutdown.

This commit is contained in:
Cory McWilliams 2024-12-27 14:27:52 -05:00
parent 45d48483d0
commit 4127898655

View File

@ -859,7 +859,7 @@ static void _tf_ssb_connection_send_history_stream_after_work(tf_ssb_connection_
{ {
tf_ssb_connection_send_history_stream_t* request = user_data; tf_ssb_connection_send_history_stream_t* request = user_data;
tf_ssb_connection_adjust_write_count(connection, -1); tf_ssb_connection_adjust_write_count(connection, -1);
if (tf_ssb_connection_is_connected(connection)) if (tf_ssb_connection_is_connected(connection) && !tf_ssb_is_shutting_down(tf_ssb_connection_get_ssb(connection)))
{ {
for (int i = 0; i < request->out_messages_count; i++) for (int i = 0; i < request->out_messages_count; i++)
{ {
@ -890,7 +890,7 @@ static void _tf_ssb_connection_send_history_stream_after_work(tf_ssb_connection_
static void _tf_ssb_connection_send_history_stream_callback(tf_ssb_connection_t* connection, void* user_data) static void _tf_ssb_connection_send_history_stream_callback(tf_ssb_connection_t* connection, void* user_data)
{ {
tf_ssb_connection_adjust_write_count(connection, 1); tf_ssb_connection_adjust_write_count(connection, 1);
if (tf_ssb_connection_is_connected(connection)) if (tf_ssb_connection_is_connected(connection) && !tf_ssb_is_shutting_down(tf_ssb_connection_get_ssb(connection)))
{ {
tf_ssb_connection_run_work(connection, _tf_ssb_connection_send_history_stream_work, _tf_ssb_connection_send_history_stream_after_work, user_data); tf_ssb_connection_run_work(connection, _tf_ssb_connection_send_history_stream_work, _tf_ssb_connection_send_history_stream_after_work, user_data);
} }