aboutsummaryrefslogtreecommitdiff
path: root/lib/easy.c
diff options
context:
space:
mode:
authorMax Dymond <max.dymond@metaswitch.com>2018-04-18 16:40:17 +0100
committerDaniel Stenberg <daniel@haxx.se>2018-09-07 09:45:29 +0200
commit7b655fcbadffc3a0297466f1527e05d4a8efe6b2 (patch)
tree16c4b8253794cd6302822d2aef7baf86e3db3a81 /lib/easy.c
parent6684653b682bae0be75ea62bb473b126923952f1 (diff)
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
Diffstat (limited to 'lib/easy.c')
-rw-r--r--lib/easy.c20
1 files changed, 20 insertions, 0 deletions
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;
+ }
+}
+