return r;
}
- // Limit parallel transfers
- r = curl_multi_setopt(self->curl, CURLMOPT_MAXCONNECTS, self->max_parallel);
+ // Set the number of open idle connections
+ r = curl_multi_setopt(self->curl, CURLMOPT_MAXCONNECTS, 16);
if (r) {
ERROR(self->ctx, "Could not set max parallel transfers: %s\n",
curl_multi_strerror(r));
return r;
}
+ // Do not open more than eight connections to the same host
+ r = curl_multi_setopt(self->curl, CURLMOPT_MAX_HOST_CONNECTIONS, 8);
+ if (r) {
+ ERROR(self->ctx, "Could not set max host connections: %s\n",
+ curl_multi_strerror(r));
+
+ return r;
+ }
+
+ // Limit total number of open connections
+ r = curl_multi_setopt(self->curl, CURLMOPT_MAX_TOTAL_CONNECTIONS, 64);
+ if (r) {
+ ERROR(self->ctx, "Could not set max total connections: %s\n",
+ curl_multi_strerror(r));
+
+ return r;
+ }
+
return 0;
}