Compare commits

...
1 Commits
17 ... 18
Author SHA1 Message Date
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; GStaticMutex dupes_mutex = G_STATIC_MUTEX_INIT;
char *urls[2] = {"http://debuginfo.clearlinux.org/debuginfo/", "http://debuginfo.fenrus.org/debuginfo/" };
int urlcounter = 0;
static GHashTable *hash; static GHashTable *hash;
@@ -119,6 +122,9 @@ static int curl_get_file(const char *url, const char *prefix, time_t timestamp)
fflush(file); fflush(file);
// printf("HTTP return code is %i\n", ret); // printf("HTTP return code is %i\n", ret);
if (ret != 200 && ret != 404)
urlcounter++;
if (ret == 200) { if (ret == 200) {
char *command = NULL; char *command = NULL;
// printf("Filename is %s\n", filename); // printf("Filename is %s\n", filename);
@@ -197,7 +203,7 @@ static void *server_thread(void *arg)
return NULL; return NULL;
} }
url = 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); close(fd);
return NULL; return NULL;
} }