Compare commits

..
7 Commits
32 .. 36
Author SHA1 Message Date
Auke Kok d3d5fab301 Tag v33 2016-11-01 09:20:19 -07:00
Auke Kok e377433a9d Return on error here too.
Missed a 'return' catching an error.
2016-11-01 09:15:12 -07:00
Auke Kok afa92c77b1 Add reasonable connection timeout limits.
Adds a 30second connection timeout, and a low bandwith timeout
value (at 1kb/sec over 30 seconds) where the attempt will fail.
This provides some feedback to users that network issues are
preventing debug info from being loaded.
2016-11-01 09:15:12 -07:00
Arjan van de Ven a01ce4c329 dumb down due to limited infra 2016-11-01 13:17:49 +00:00
Arjan van de Ven 1eaaac582c use http/2 2016-11-01 12:56:35 +00:00
Arjan van de Ven 935dbee3c7 use CDN urls 2016-11-01 12:53:04 +00:00
Arjan van de Ven 0065ef2670 don't spew the journal 2016-11-01 12:52:17 +00:00
3 changed files with 19 additions and 4 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.66])
AC_INIT(clr-debug-info, 32, arjan@linux.intel.com)
AC_INIT(clr-debug-info, 33, arjan@linux.intel.com)
AM_INIT_AUTOMAKE([foreign -Wall -W subdir-objects])
AM_SILENT_RULES([yes])
AC_PROG_CC
+1
View File
@@ -85,6 +85,7 @@ void try_to_get(const char *path, int pid, time_t timestamp)
if (ret == 0 && cred.pid == pid) {
printf("Recursion\n");
close(sockfd);
return;
}
command = NULL;
+17 -3
View File
@@ -55,8 +55,8 @@
static pthread_mutex_t dupes_mutex = PTHREAD_MUTEX_INITIALIZER;
char *urls[2] = { "https://debuginfo.clearlinux.org/debuginfo/",
"https://debuginfo.clearlinux.org/debuginfo/" };
char *urls[2] = { "https://cdn.download.clearlinux.org/debuginfo/",
"https://cdn.download.clearlinux.org/debuginfo/" };
int urlcounter = 1;
static NcHashmap *hash = NULL;
@@ -189,6 +189,19 @@ static int curl_get_file(const char *url, const char *prefix, time_t timestamp)
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, file);
curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
/*
* Some sane timeout values to prevent stalls
*
* Connect timeout is for first connection to the server.
* The low speed timeout is for slow downloads. Since many
* files are several mB large, we want to prevent them from
* taking forever. (1kB/sec avg over 30secs).
*/
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 30);
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 30);
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1024);
if (timestamp) {
curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
@@ -322,6 +335,7 @@ static void *server_thread(void *arg)
}
gettimeofday(&after, NULL);
#if 0
if (timedelta(before, after) > 0.6)
printf("Request for %s took %5.2f seconds (%i - %i)\n",
url,
@@ -329,7 +343,7 @@ static void *server_thread(void *arg)
(1.0 * after.tv_usec - before.tv_usec) / 1000000.0,
ret,
(int)timestamp);
#endif
/* tell the other side we're done with the download */
wr = write(fd, "ok", 3);