From 929ae1b709c2c6303b79f0b39cc166a46623aff7 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Thu, 2 May 2024 19:37:38 -0400 Subject: [PATCH] After eyeballing lingering requests, clean up requests after the response to an async (non-streaming) request is done. --- src/ssb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ssb.c b/src/ssb.c index c4783851..bf2730bb 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -785,7 +785,7 @@ void tf_ssb_connection_rpc_send(tf_ssb_connection_t* connection, uint8_t flags, _tf_ssb_connection_box_stream_send(connection, combined, 1 + 2 * sizeof(uint32_t) + size); tf_free(combined); connection->ssb->rpc_out++; - if (flags & k_ssb_rpc_flag_end_error) + if ((flags & k_ssb_rpc_flag_end_error) || (request_number < 0 && !(flags & k_ssb_rpc_flag_stream))) { tf_ssb_connection_remove_request(connection, request_number); } @@ -1551,6 +1551,10 @@ static void _tf_ssb_connection_rpc_recv(tf_ssb_connection_t* connection, uint8_t callback(connection, flags, request_number, val, message, size, user_data); POST_CALLBACK(connection->ssb, callback); tf_trace_end(connection->ssb->trace); + if (!(flags & k_ssb_rpc_flag_stream)) + { + tf_ssb_connection_remove_request(connection, -request_number); + } } } else if (JS_IsObject(val))