diff --git a/src/ssb.c b/src/ssb.c index 9e13288c1..206cdfa7b 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -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); }