ssb: More uv_async_send paranoia. #96

This commit is contained in:
Cory McWilliams 2025-01-02 12:40:11 -05:00
parent cd2fe9f8d9
commit 3dcafdf403

View File

@ -2019,6 +2019,11 @@ static void _tf_ssb_connection_on_close(uv_handle_t* handle)
static void _tf_ssb_connection_on_tcp_recv_internal(tf_ssb_connection_t* connection, const void* data, ssize_t nread)
{
if (connection->is_closing)
{
return;
}
if (nread >= 0)
{
if (connection->recv_size + nread > sizeof(connection->recv_buffer))
@ -2714,7 +2719,7 @@ static void _tf_ssb_connection_finalizer(JSRuntime* runtime, JSValue value)
static void _tf_ssb_connection_process_message_async(uv_async_t* async)
{
tf_ssb_connection_t* connection = async->data;
if (_tf_ssb_connection_box_stream_recv(connection))
if (!connection->is_closing && _tf_ssb_connection_box_stream_recv(connection))
{
uv_async_send(&connection->async);
}