Compare commits

...
2 Commits
17 ... 19
Author SHA1 Message Date
Arjan van de Ven bcff8fae39 default to the other server for now 2015-04-24 17:55:53 -04:00
Arjan van de Ven 66bab25bcd implement multi-url setup 2015-03-23 14:45:00 -04:00
+7 -1
View File
@@ -43,6 +43,9 @@
GStaticMutex dupes_mutex = G_STATIC_MUTEX_INIT;
char *urls[2] = {"http://debuginfo.clearlinux.org/debuginfo/", "http://debuginfo.fenrus.org/debuginfo/" };
int urlcounter = 1;
static GHashTable *hash;
@@ -119,6 +122,9 @@ static int curl_get_file(const char *url, const char *prefix, time_t timestamp)
fflush(file);
// printf("HTTP return code is %i\n", ret);
if (ret != 200 && ret != 404)
urlcounter++;
if (ret == 200) {
char *command = NULL;
// printf("Filename is %s\n", filename);
@@ -197,7 +203,7 @@ static void *server_thread(void *arg)
return NULL;
}
url = NULL;
if (asprintf(&url, "http://debuginfo.clearlinux.org/debuginfo/%s%s.tar", prefix, path) < 0) {
if (asprintf(&url, "%s%s%s.tar", urls[urlcounter % 2], prefix, path) < 0) {
close(fd);
return NULL;
}