From f79ec895021efa817cd6550a1650d9735b81b301 Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 25 May 2016 20:08:20 +0100 Subject: [PATCH] Guard usage of CURLMOPT_MAX_TOTAL_CONNECTIONS Check the Curl patch version to avoid breaking on older sustems. --- simgear/io/HTTPClient.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/simgear/io/HTTPClient.cxx b/simgear/io/HTTPClient.cxx index 2d7aebb0..4fcb4d7b 100644 --- a/simgear/io/HTTPClient.cxx +++ b/simgear/io/HTTPClient.cxx @@ -80,7 +80,9 @@ public: // see https://curl.haxx.se/libcurl/c/CURLMOPT_PIPELINING.html // we request HTTP 1.1 pipelining curl_multi_setopt(curlMulti, CURLMOPT_PIPELINING, 1 /* aka CURLPIPE_HTTP1 */); +#if (LIBCURL_VERSION_MINOR >= 30) curl_multi_setopt(curlMulti, CURLMOPT_MAX_TOTAL_CONNECTIONS, (long) maxConnections); +#endif curl_multi_setopt(curlMulti, CURLMOPT_MAX_PIPELINE_LENGTH, (long) maxPipelineDepth); curl_multi_setopt(curlMulti, CURLMOPT_MAX_HOST_CONNECTIONS, @@ -138,7 +140,9 @@ Client::~Client() void Client::setMaxConnections(unsigned int maxCon) { d->maxConnections = maxCon; +#if (LIBCURL_VERSION_MINOR >= 30) curl_multi_setopt(d->curlMulti, CURLMOPT_MAX_TOTAL_CONNECTIONS, (long) maxCon); +#endif } void Client::setMaxHostConnections(unsigned int maxHostCon) -- 2.39.5