ssb: Avoid scheduling idle work while shutting down, so that we shut down sooner.
This commit is contained in:
parent
852c25296a
commit
45d48483d0
@ -903,16 +903,19 @@ static void _tf_ssb_connection_send_history_stream_callback(tf_ssb_connection_t*
|
||||
static void _tf_ssb_connection_send_history_stream(
|
||||
tf_ssb_connection_t* connection, int32_t request_number, const char* author, int64_t sequence, bool keys, bool live, bool end_request)
|
||||
{
|
||||
tf_ssb_connection_send_history_stream_t* async = tf_malloc(sizeof(tf_ssb_connection_send_history_stream_t));
|
||||
*async = (tf_ssb_connection_send_history_stream_t) {
|
||||
.request_number = request_number,
|
||||
.sequence = sequence,
|
||||
.keys = keys,
|
||||
.live = live,
|
||||
.end_request = end_request,
|
||||
};
|
||||
snprintf(async->author, sizeof(async->author), "%s", author);
|
||||
tf_ssb_connection_schedule_idle(connection, _tf_ssb_connection_send_history_stream_callback, async);
|
||||
if (!tf_ssb_is_shutting_down(tf_ssb_connection_get_ssb(connection)))
|
||||
{
|
||||
tf_ssb_connection_send_history_stream_t* async = tf_malloc(sizeof(tf_ssb_connection_send_history_stream_t));
|
||||
*async = (tf_ssb_connection_send_history_stream_t) {
|
||||
.request_number = request_number,
|
||||
.sequence = sequence,
|
||||
.keys = keys,
|
||||
.live = live,
|
||||
.end_request = end_request,
|
||||
};
|
||||
snprintf(async->author, sizeof(async->author), "%s", author);
|
||||
tf_ssb_connection_schedule_idle(connection, _tf_ssb_connection_send_history_stream_callback, async);
|
||||
}
|
||||
}
|
||||
|
||||
static void _tf_ssb_rpc_createHistoryStream(
|
||||
@ -1197,7 +1200,7 @@ static void _tf_ssb_rpc_ebt_replicate(tf_ssb_connection_t* connection, uint8_t f
|
||||
tf_ssb_connection_adjust_read_backpressure(connection, 1);
|
||||
tf_ssb_verify_strip_and_store_message(ssb, args, _tf_ssb_rpc_ebt_replicate_store_callback, connection);
|
||||
|
||||
if (tf_ssb_connection_get_sent_clock(connection))
|
||||
if (tf_ssb_connection_get_sent_clock(connection) && !tf_ssb_is_shutting_down(ssb))
|
||||
{
|
||||
tf_ssb_connection_set_sent_clock(connection, false);
|
||||
resend_clock_t* resend = tf_malloc(sizeof(resend_clock_t));
|
||||
|
Loading…
Reference in New Issue
Block a user