diff --git a/src/ssb.rpc.c b/src/ssb.rpc.c index dd1a91ed..a3a56d74 100644 --- a/src/ssb.rpc.c +++ b/src/ssb.rpc.c @@ -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_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++) { @@ -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) { 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); }