From 5050edb12484551f4c666212409c117cf38f9784 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 2 Sep 2019 23:22:15 +0200 Subject: cleanup: move functions out of url.c and make them static Closes #4289 --- lib/easy.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'lib/easy.c') diff --git a/lib/easy.c b/lib/easy.c index 1d49a0366..0b0016be4 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -1124,6 +1124,35 @@ CURLcode curl_easy_send(struct Curl_easy *data, const void *buffer, return result; } +/* + * Wrapper to call functions in Curl_conncache_foreach() + * + * Returns always 0. + */ +static int conn_upkeep(struct connectdata *conn, + void *param) +{ + /* Param is unused. */ + (void)param; + + if(conn->handler->connection_check) { + /* Do a protocol-specific keepalive check on the connection. */ + conn->handler->connection_check(conn, CONNCHECK_KEEPALIVE); + } + + return 0; /* continue iteration */ +} + +static CURLcode upkeep(struct conncache *conn_cache, void *data) +{ + /* Loop over every connection and make connection alive. */ + Curl_conncache_foreach(data, + conn_cache, + data, + conn_upkeep); + return CURLE_OK; +} + /* * Performs connection upkeep for the given session handle. */ @@ -1135,7 +1164,7 @@ CURLcode curl_easy_upkeep(struct Curl_easy *data) if(data->multi_easy) { /* Use the common function to keep connections alive. */ - return Curl_upkeep(&data->multi_easy->conn_cache, data); + return upkeep(&data->multi_easy->conn_cache, data); } else { /* No connections, so just return success */ -- cgit v1.2.3