forked from cory/tildefriends
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:
10
src/http.c
10
src/http.c
@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user