added LinkTable_gap_fill() to fill in the gaps in the link table when it is loaded from the disk
This commit is contained in:
parent
15cbe8a693
commit
9717d016ed
26
src/link.c
26
src/link.c
|
@ -211,6 +211,24 @@ static void LinkTable_fill(LinkTable *linktbl)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief fill in the gaps in a link table
|
||||||
|
*/
|
||||||
|
static void LinkTable_gap_fill(LinkTable *linktbl)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < linktbl->num; i++) {
|
||||||
|
if (linktbl->links[i]->type == LINK_INVALID) {
|
||||||
|
Link_get_stat(linktbl->links[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Block until the gaps are filled */
|
||||||
|
while (curl_multi_perform_once()) {
|
||||||
|
usleep(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void LinkTable_free(LinkTable *linktbl)
|
static void LinkTable_free(LinkTable *linktbl)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < linktbl->num; i++) {
|
for (int i = 0; i < linktbl->num; i++) {
|
||||||
|
@ -310,14 +328,18 @@ URL, URL: %s, HTTP %ld\n", url, http_resp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in the link table */
|
|
||||||
if (!skip_fill) {
|
if (!skip_fill) {
|
||||||
|
/* Fill in the link table */
|
||||||
LinkTable_fill(linktbl);
|
LinkTable_fill(linktbl);
|
||||||
|
} else {
|
||||||
|
/* Fill in the holes in the link table */
|
||||||
|
LinkTable_gap_fill(linktbl);
|
||||||
|
}
|
||||||
|
|
||||||
/* Save the link table */
|
/* Save the link table */
|
||||||
if (CACHE_SYSTEM_INIT) {
|
if (CACHE_SYSTEM_INIT) {
|
||||||
LinkTable_disk_save(linktbl, unescaped_path);
|
LinkTable_disk_save(linktbl, unescaped_path);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
curl_free(unescaped_path);
|
curl_free(unescaped_path);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue