Tryingn to button down websocket lifetime issues.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4795 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2024-01-27 02:36:08 +00:00
parent f479165aac
commit 48b967f5b6
3 changed files with 28 additions and 1 deletions

View File

@ -158,6 +158,15 @@ static void _http_connection_destroy(tf_http_connection_t* connection, const cha
{
connection->is_shutting_down = true;
if (connection->request && connection->request->on_close)
{
tf_http_close_callback* on_close = connection->request->on_close;
connection->request->on_close = NULL;
tf_trace_begin(connection->http->trace, connection->trace_name ? connection->trace_name : "websocket");
on_close(connection->request);
tf_trace_end(connection->http->trace);
}
if (connection->tcp.data && !uv_is_closing((uv_handle_t*)&connection->tcp))
{
uv_close((uv_handle_t*)&connection->tcp, _http_connection_on_close);
@ -896,6 +905,7 @@ void tf_http_request_release(tf_http_request_t* request)
}
if (--request->ref_count == 0)
{
request->connection->request = NULL;
tf_free(request);
}
}