mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
only call device/get_status every 60 seconds (hardcoded for now)
This commit is contained in:
@@ -454,6 +454,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
ctx->sv_writefiles = stringv_alloc();
|
||||
ctx->sv_readonlyfiles = stringv_alloc();
|
||||
ctx->last_status_check = 0;
|
||||
ctx->interval_status_check = 60;
|
||||
|
||||
ret = fuse_main(argc, argv, &mediafirefs_oper, ctx);
|
||||
|
||||
|
||||
@@ -109,15 +109,19 @@ int mediafirefs_getattr(const char *path, struct stat *stbuf)
|
||||
* since getattr is called before every other call (except for getattr,
|
||||
* read and write) wee only call folder_tree_update in the getattr call
|
||||
* and not the others
|
||||
*
|
||||
* FIXME: only call folder_tree_update if it has not been called for a set
|
||||
* amount of time
|
||||
*/
|
||||
struct mediafirefs_context_private *ctx;
|
||||
int retval;
|
||||
time_t now;
|
||||
|
||||
ctx = fuse_get_context()->private_data;
|
||||
folder_tree_update(ctx->tree, ctx->conn, false);
|
||||
|
||||
now = time(NULL);
|
||||
if (now - ctx->last_status_check > ctx->interval_status_check) {
|
||||
folder_tree_update(ctx->tree, ctx->conn, false);
|
||||
ctx->last_status_check = now;
|
||||
}
|
||||
|
||||
retval = folder_tree_getattr(ctx->tree, ctx->conn, path, stbuf);
|
||||
|
||||
if (retval != 0 && stringv_mem(ctx->sv_writefiles, path)) {
|
||||
|
||||
@@ -35,6 +35,8 @@ struct timespec;
|
||||
struct mediafirefs_context_private {
|
||||
mfconn *conn;
|
||||
folder_tree *tree;
|
||||
time_t last_status_check;
|
||||
time_t interval_status_check;
|
||||
char *configfile;
|
||||
char *dircache;
|
||||
char *filecache;
|
||||
|
||||
Reference in New Issue
Block a user