http: Prevent reentering tf_http_destroy.
This commit is contained in:
parent
4c3df34950
commit
60d4b06057
11
src/http.c
11
src/http.c
@ -84,6 +84,7 @@ typedef struct _tf_http_listener_t
|
||||
typedef struct _tf_http_t
|
||||
{
|
||||
bool is_shutting_down;
|
||||
bool is_in_destroy;
|
||||
|
||||
tf_http_listener_t** listeners;
|
||||
int listeners_count;
|
||||
@ -786,7 +787,13 @@ static void _http_free_listener_on_close(uv_handle_t* handle)
|
||||
|
||||
void tf_http_destroy(tf_http_t* http)
|
||||
{
|
||||
if (http->is_in_destroy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
http->is_shutting_down = true;
|
||||
http->is_in_destroy = true;
|
||||
|
||||
for (int i = 0; i < http->connections_count; i++)
|
||||
{
|
||||
@ -845,6 +852,10 @@ void tf_http_destroy(tf_http_t* http)
|
||||
|
||||
tf_free(http);
|
||||
}
|
||||
else
|
||||
{
|
||||
http->is_in_destroy = false;
|
||||
}
|
||||
}
|
||||
|
||||
const char* tf_http_status_text(int status)
|
||||
|
Loading…
x
Reference in New Issue
Block a user