aboutsummaryrefslogtreecommitdiffstats
path: root/debuginfod
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2020-01-02 17:02:42 +0100
committerMark Wielaard <mark@klomp.org>2020-01-10 00:12:00 +0100
commitb8d85ed024a745cff05e56c6337d95d654d5294a (patch)
tree1c3fb3800c51654f54f887618a6e2cc90d52c5b6 /debuginfod
parent288c76775f2d27976eb269e568b53c742d973dbc (diff)
downloadplatform_external_elfutils-b8d85ed024a745cff05e56c6337d95d654d5294a.tar.gz
platform_external_elfutils-b8d85ed024a745cff05e56c6337d95d654d5294a.tar.bz2
platform_external_elfutils-b8d85ed024a745cff05e56c6337d95d654d5294a.zip
debuginfod: Use DEBUGINFOD_TIMEOUT as seconds to get at least 100K.
Use just one timeout using CURLOPT_LOW_SPEED_TIME (default 90 seconds) and CURLOPT_LOW_SPEED_LIMIT (100K). Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'debuginfod')
-rw-r--r--debuginfod/ChangeLog8
-rw-r--r--debuginfod/debuginfod-client.c30
2 files changed, 21 insertions, 17 deletions
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 6cfb4e24..18778521 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,11 @@
+2019-01-02 Mark Wielaard <mark@klomp.org>
+
+ * debuginfod.cxx (default_connect_timeout): Removed.
+ (default_transfer_timeout): Removed.
+ (default_timeout): New. Default to 90 seconds.
+ (debuginfod_query_server): Parse server_timeout_envvar as one number.
+ Set as CURLOPT_LOW_SPEED_TIME, with CURL_OPT_LOW_SPEED_LIMITE as 100K.
+
2020-01-09 Frank Ch. Eigler <fche@redhat.com>
* debuginfod-client.c (add_extra_headers): New function,
diff --git a/debuginfod/debuginfod-client.c b/debuginfod/debuginfod-client.c
index 66ccb21a..e5a2e824 100644
--- a/debuginfod/debuginfod-client.c
+++ b/debuginfod/debuginfod-client.c
@@ -105,10 +105,9 @@ static const char *server_urls_envvar = DEBUGINFOD_URLS_ENV_VAR;
static const char *url_delim = " ";
static const char url_delim_char = ' ';
-/* Timeout for debuginfods, in seconds. */
+/* Timeout for debuginfods, in seconds (to get at least 100K). */
static const char *server_timeout_envvar = DEBUGINFOD_TIMEOUT_ENV_VAR;
-static const long default_connect_timeout = 5;
-static const long default_transfer_timeout = -1; /* unlimited */
+static const long default_timeout = 90;
/* Data associated with a particular CURL easy handle. Passed to
@@ -483,18 +482,10 @@ debuginfod_query_server (debuginfod_client *c,
return fd;
}
- long connect_timeout = default_connect_timeout;
- long transfer_timeout = default_transfer_timeout;
+ long timeout = default_timeout;
const char* timeout_envvar = getenv(server_timeout_envvar);
if (timeout_envvar != NULL)
- {
- long ct, tt;
- rc = sscanf(timeout_envvar, "%ld,%ld", &ct, &tt);
- if (rc >= 1)
- connect_timeout = ct;
- if (rc >= 2)
- transfer_timeout = tt;
- }
+ timeout = atoi (timeout_envvar);
/* make a copy of the envvar so it can be safely modified. */
server_urls = strdup(urls_envvar);
@@ -586,10 +577,15 @@ debuginfod_query_server (debuginfod_client *c,
CURLOPT_WRITEFUNCTION,
debuginfod_write_callback);
curl_easy_setopt(data[i].handle, CURLOPT_WRITEDATA, (void*)&data[i]);
- if (connect_timeout >= 0)
- curl_easy_setopt(data[i].handle, CURLOPT_CONNECTTIMEOUT, connect_timeout);
- if (transfer_timeout >= 0)
- curl_easy_setopt(data[i].handle, CURLOPT_TIMEOUT, transfer_timeout);
+ if (timeout > 0)
+ {
+ /* Make sure there is at least some progress,
+ try to get at least 100K per timeout seconds. */
+ curl_easy_setopt (data[i].handle, CURLOPT_LOW_SPEED_TIME,
+ timeout);
+ curl_easy_setopt (data[i].handle, CURLOPT_LOW_SPEED_LIMIT,
+ 100 * 1024L);
+ }
curl_easy_setopt(data[i].handle, CURLOPT_FILETIME, (long) 1);
curl_easy_setopt(data[i].handle, CURLOPT_FOLLOWLOCATION, (long) 1);
curl_easy_setopt(data[i].handle, CURLOPT_FAILONERROR, (long) 1);