From 7b655fcbadffc3a0297466f1527e05d4a8efe6b2 Mon Sep 17 00:00:00 2001 From: Max Dymond Date: Wed, 18 Apr 2018 16:40:17 +0100 Subject: upkeep: add a connection upkeep API: curl_easy_conn_upkeep() Add functionality so that protocols can do custom keepalive on their connections, when an external API function is called. Add docs for the new options in 7.62.0 Closes #1641 --- lib/easy.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/easy.c') diff --git a/lib/easy.c b/lib/easy.c index 027d0bef3..83433f1f5 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -1197,3 +1197,23 @@ CURLcode curl_easy_send(struct Curl_easy *data, const void *buffer, return result; } + +/* + * Performs connection upkeep for the given session handle. + */ +CURLcode curl_easy_conn_upkeep(struct Curl_easy *data) +{ + /* Verify that we got an easy handle we can work with. */ + if(!GOOD_EASY_HANDLE(data)) + return CURLE_BAD_FUNCTION_ARGUMENT; + + if(data->multi_easy) { + /* Use the common function to keep connections alive. */ + return Curl_conn_upkeep(&data->multi_easy->conn_cache, data); + } + else { + /* No connections, so just return success */ + return CURLE_OK; + } +} + -- cgit v1.2.3