1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

multi: force connections to get closed in close_all_connections

Several independent reports on infinite loops hanging in the
close_all_connections() function when closing a multi handle, can be
fixed by first marking the connection to get closed before calling
Curl_disconnect.

This is more fixing-the-symptom rather than the underlying problem
though.

Bug: https://curl.haxx.se/mail/lib-2016-10/0011.html
Bug: https://curl.haxx.se/mail/lib-2016-10/0059.html

Reported-by: Dan Fandrich, Valentin David, Miloš Ljumović
This commit is contained in:
Daniel Stenberg 2016-10-21 11:03:10 +02:00
parent 406506ca92
commit 6290c3c26b

View File

@ -42,6 +42,7 @@
#include "multihandle.h" #include "multihandle.h"
#include "pipeline.h" #include "pipeline.h"
#include "sigpipe.h" #include "sigpipe.h"
#include "connect.h"
/* The last 3 #include files should be in this order */ /* The last 3 #include files should be in this order */
#include "curl_printf.h" #include "curl_printf.h"
#include "curl_memory.h" #include "curl_memory.h"
@ -2177,6 +2178,7 @@ static void close_all_connections(struct Curl_multi *multi)
conn->data->easy_conn = NULL; /* clear the easy handle's connection conn->data->easy_conn = NULL; /* clear the easy handle's connection
pointer */ pointer */
/* This will remove the connection from the cache */ /* This will remove the connection from the cache */
connclose(conn, "kill all");
(void)Curl_disconnect(conn, FALSE); (void)Curl_disconnect(conn, FALSE);
sigpipe_restore(&pipe_st); sigpipe_restore(&pipe_st);