diff options
-rw-r--r-- | lib/connect.c | 5 | ||||
-rw-r--r-- | lib/ftp.c | 1 | ||||
-rw-r--r-- | lib/url.c | 6 |
3 files changed, 10 insertions, 2 deletions
diff --git a/lib/connect.c b/lib/connect.c index 2fd9883b9..67f73343c 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -758,10 +758,13 @@ CURLcode Curl_is_connected(struct connectdata *conn, /* use this socket from now on */ conn->sock[sockindex] = conn->tempsock[i]; conn->ip_addr = conn->tempaddr[i]; + conn->tempsock[i] = CURL_SOCKET_BAD; /* close the other socket, if open */ - if(conn->tempsock[other] != CURL_SOCKET_BAD) + if(conn->tempsock[other] != CURL_SOCKET_BAD) { Curl_closesocket(conn, conn->tempsock[other]); + conn->tempsock[other] = CURL_SOCKET_BAD; + } /* see if we need to do any proxy magic first once we connected */ code = Curl_connected_proxy(conn, sockindex); @@ -1866,7 +1866,6 @@ static CURLcode proxy_magic(struct connectdata *conn, if(conn->tunnel_state[SECONDARYSOCKET] != TUNNEL_COMPLETE) { /* the CONNECT procedure is not complete, the tunnel is not yet up */ state(conn, FTP_STOP); /* this phase is completed */ - conn->bits.tcpconnect[SECONDARYSOCKET] = FALSE; return result; } else @@ -2503,6 +2503,10 @@ static void conn_free(struct connectdata *conn) Curl_closesocket(conn, conn->sock[SECONDARYSOCKET]); if(CURL_SOCKET_BAD != conn->sock[FIRSTSOCKET]) Curl_closesocket(conn, conn->sock[FIRSTSOCKET]); + if(CURL_SOCKET_BAD != conn->tempsock[0]) + Curl_closesocket(conn, conn->tempsock[0]); + if(CURL_SOCKET_BAD != conn->tempsock[1]) + Curl_closesocket(conn, conn->tempsock[1]); #if defined(USE_NTLM) && defined(NTLM_WB_ENABLED) Curl_ntlm_wb_cleanup(conn); @@ -3522,6 +3526,8 @@ static struct connectdata *allocate_conn(struct SessionHandle *data) conn->sock[FIRSTSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */ conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */ + conn->tempsock[0] = CURL_SOCKET_BAD; /* no file descriptor */ + conn->tempsock[1] = CURL_SOCKET_BAD; /* no file descriptor */ conn->connection_id = -1; /* no ID */ conn->port = -1; /* unknown at this point */ |