Explicitly set libcurl options (#1789)

* Explicitly set libcurl options to ignore SIGPIPE, use TCP NAGLE and ensure we are re-using connections. These should be 'enabled by default' by libcurl, but we need to ensure we are setting them to their supposed default

Potentially resolves the following issues: #494, #753, #792, #884, #1162, #1408, #1520, #1526 + others.
This commit is contained in:
abraunegg 2022-01-12 09:14:04 +11:00 committed by GitHub
parent 6f53580583
commit f72f6c9262
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -455,6 +455,17 @@ final class OneDriveApi
http.handle.set(CurlOption.max_recv_speed_large,userRateLimit); http.handle.set(CurlOption.max_recv_speed_large,userRateLimit);
} }
// Explicitly set libcurl options
// https://curl.se/libcurl/c/CURLOPT_NOSIGNAL.html
// Ensure that nosignal is set to 0 - Setting CURLOPT_NOSIGNAL to 0 makes libcurl ask the system to ignore SIGPIPE signals
http.handle.set(CurlOption.nosignal,0);
// https://curl.se/libcurl/c/CURLOPT_TCP_NODELAY.html
// Ensure that TCP_NODELAY is set to 0 to ensure that TCP NAGLE is enabled
http.handle.set(CurlOption.tcp_nodelay,0);
// https://curl.se/libcurl/c/CURLOPT_FORBID_REUSE.html
// Ensure that we ARE reusing connections - setting to 0 ensures that we are reusing connections
http.handle.set(CurlOption.forbid_reuse,0);
// Do we set the dryRun handlers? // Do we set the dryRun handlers?
if (cfg.getValueBool("dry_run")) { if (cfg.getValueBool("dry_run")) {
.dryRun = true; .dryRun = true;