diff --git a/src/http.c b/src/http.c index a99d6840..86e545d1 100644 --- a/src/http.c +++ b/src/http.c @@ -629,6 +629,12 @@ static void _http_on_connection(uv_stream_t* stream, int status) { tf_http_listener_t* listener = stream->data; tf_http_t* http = listener->http; + if (http->is_shutting_down) + { + tf_printf("Ignoring HTTP connection during shutdown.\n"); + return; + } + tf_http_connection_t* connection = tf_malloc(sizeof(tf_http_connection_t)); *connection = (tf_http_connection_t) { .http = http, .tcp = { .data = connection }, .is_receiving_headers = true }; if (listener->tls) diff --git a/src/ssb.c b/src/ssb.c index cf59311f..db5137ae 100644 --- a/src/ssb.c +++ b/src/ssb.c @@ -2926,7 +2926,7 @@ static void _tf_ssb_connection_tunnel_callback( tf_ssb_connection_t* tf_ssb_connection_tunnel_create(tf_ssb_t* ssb, const char* portal_id, int32_t request_number, const char* target_id, int connect_flags) { tf_ssb_connection_t* connection = tf_ssb_connection_get(ssb, portal_id); - if (!connection) + if (!connection || ssb->shutting_down) { return NULL; } @@ -3052,6 +3052,11 @@ static void _tf_ssb_on_connection(uv_stream_t* stream, int status) return; } + if (ssb->shutting_down) + { + tf_printf("Ignoring SHS connection during shutdown.\n"); + } + tf_ssb_connection_t* connection = _tf_ssb_connection_create_internal(ssb, "srv", s_connection_index++); connection->tcp.data = connection;