summaryrefslogtreecommitdiff
path: root/lib/connect.c
diff options
context:
space:
mode:
authorYamada Yasuharu <yasuharu.yamada@access-company.com>2015-03-23 22:46:58 +0100
committerDaniel Stenberg <daniel@haxx.se>2015-03-23 22:46:58 +0100
commitecc4940df2c286702262f8c21d7369f893e78968 (patch)
treea992f280dcb0f388428959c1ae32fbd19d81d3a9 /lib/connect.c
parent4b02b84897c0038ee9d52891307ec10e5f50da01 (diff)
downloadcurl-ecc4940df2c286702262f8c21d7369f893e78968.tar.gz
curl_easy_recv/send: make them work with the multi interface
By making sure Curl_getconnectinfo() uses the correct connection cache to find the last connection.
Diffstat (limited to 'lib/connect.c')
-rw-r--r--lib/connect.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/connect.c b/lib/connect.c
index b67db902f..68317d986 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -1202,15 +1202,20 @@ curl_socket_t Curl_getconnectinfo(struct SessionHandle *data,
DEBUGASSERT(data);
- /* this only works for an easy handle that has been used for
- curl_easy_perform()! */
- if(data->state.lastconnect && data->multi_easy) {
+ /* this works for an easy handle:
+ * - that has been used for curl_easy_perform()
+ * - that is associated with a multi handle, and whose connection
+ * was detached with CURLOPT_CONNECT_ONLY
+ */
+ if(data->state.lastconnect && (data->multi_easy || data->multi)) {
struct connectdata *c = data->state.lastconnect;
struct connfind find;
find.tofind = data->state.lastconnect;
find.found = FALSE;
- Curl_conncache_foreach(data->multi_easy->conn_cache, &find, conn_is_conn);
+ Curl_conncache_foreach(data->multi_easy?
+ data->multi_easy->conn_cache:
+ data->multi->conn_cache, &find, conn_is_conn);
if(!find.found) {
data->state.lastconnect = NULL;