mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
fuse: when the hashtable fails to load, start a new one instead of failing
This commit is contained in:
30
fuse/main.c
30
fuse/main.c
@@ -312,25 +312,27 @@ static void open_hashtbl(const char *dircache, const char *filecache,
|
|||||||
|
|
||||||
*tree = folder_tree_load(fp, filecache);
|
*tree = folder_tree_load(fp, filecache);
|
||||||
|
|
||||||
if (*tree == NULL) {
|
|
||||||
fprintf(stderr, "cannot load directory hashtable\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
// TODO: make the maximum cache size configurable
|
if (*tree != NULL) {
|
||||||
// size is given in bytes and current default is 1 GiB
|
|
||||||
folder_tree_cleanup_filecache(*tree, 1073741824);
|
|
||||||
|
|
||||||
folder_tree_update(*tree, conn, false);
|
// TODO: make the maximum cache size configurable
|
||||||
} else {
|
// size is given in bytes and current default is 1 GiB
|
||||||
// file doesn't exist
|
folder_tree_cleanup_filecache(*tree, 1073741824);
|
||||||
fprintf(stderr, "creating new hashtable\n");
|
|
||||||
*tree = folder_tree_create(filecache);
|
|
||||||
|
|
||||||
folder_tree_rebuild(*tree, conn);
|
folder_tree_update(*tree, conn, false);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "cannot load directory hashtable - starting"
|
||||||
|
" a new one\n");
|
||||||
}
|
}
|
||||||
|
// file doesn't exist or is corrupt
|
||||||
|
fprintf(stderr, "creating new hashtable\n");
|
||||||
|
*tree = folder_tree_create(filecache);
|
||||||
|
|
||||||
|
folder_tree_rebuild(*tree, conn);
|
||||||
|
|
||||||
//folder_tree_housekeep(tree);
|
//folder_tree_housekeep(tree);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user