HTTP 429, LinkTable_print(), variable shadowing

changed the way HTTP 429 gets handled while querying for file stats
fixed LinkTable_print(), added variable shawdowing warning in Makefile
This commit is contained in:
Fufu Fang 2019-04-27 02:31:18 +01:00
parent 2a2ac2dce2
commit ba8c7232e2
3 changed files with 13 additions and 12 deletions

View File

@ -1,9 +1,10 @@
VERSION=1.1.4
CFLAGS+= -g -O2 -Wall -Wextra -D_FILE_OFFSET_BITS=64 -DVERSION=\"$(VERSION)\" \
`pkg-config --cflags-only-I gumbo libcurl fuse`
CFLAGS+= -g -O2 -Wall -Wextra -Wshadow\
-D_FILE_OFFSET_BITS=64 -DVERSION=\"$(VERSION)\" \
`pkg-config --cflags-only-I gumbo libcurl fuse`
LDFLAGS+= -pthread -lgumbo -lcurl -lfuse -lcrypto \
`pkg-config --libs-only-L gumbo libcurl fuse`
`pkg-config --libs-only-L gumbo libcurl fuse`
COBJS = main.o network.o fuse_local.o link.o cache.o util.o
prefix ?= /usr/local

View File

@ -175,8 +175,13 @@ void Link_set_stat(Link* this_link, CURL *curl)
this_link->type = LINK_FILE;
}
} else {
fprintf(stderr, "Link_set_stat(): HTTP %ld.\n", http_resp);
fprintf(stderr, "Link_set_stat(): HTTP %ld", http_resp);
this_link->type = LINK_INVALID;
if (http_resp == HTTP_TOO_MANY_REQUESTS) {
fprintf(stderr, ", re-adding the link to the queue\n");
Link_get_stat(this_link);
}
fprintf(stderr, ".\n");
}
}
@ -232,7 +237,7 @@ static void LinkTable_free(LinkTable *linktbl)
static void LinkTable_print(LinkTable *linktbl)
{
int i = 0;
int j = 0;
fprintf(stderr, "--------------------------------------------\n");
fprintf(stderr, " LinkTable %p for %s\n", linktbl,
linktbl->links[0]->f_url);
@ -249,12 +254,11 @@ static void LinkTable_print(LinkTable *linktbl)
if ((this_link->type != LINK_FILE) &&
(this_link->type != LINK_DIR) &&
(this_link->type != LINK_HEAD)) {
i++;
j++;
}
}
fprintf(stderr, "--------------------------------------------\n");
fprintf(stderr, "LinkTable_print(): Invalid link count: %d, %s.\n", i,
fprintf(stderr, "LinkTable_print(): Invalid link count: %d, %s.\n", j,
linktbl->links[0]->f_url);
fprintf(stderr, "--------------------------------------------\n");
}

View File

@ -113,10 +113,6 @@ static void curl_process_msgs(CURLMsg *curl_msg, int n_running_curl, int n_mesgs
sleep(HTTP_429_WAIT);
slept = 1;
}
/* Re-add the link into the queue, if it is a file stat query */
if (transfer->type == FILESTAT) {
Link_get_stat(transfer->link);
}
} else {
slept = 0;
}