From 21d3353d64356ef04d223f9a5b7dce1828e6460e Mon Sep 17 00:00:00 2001 From: root Date: Tue, 9 Sep 2025 04:50:35 +0000 Subject: [PATCH] Update --- turbonfs/src/main.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/turbonfs/src/main.cpp b/turbonfs/src/main.cpp index e5d7fb28..d05d99f7 100644 --- a/turbonfs/src/main.cpp +++ b/turbonfs/src/main.cpp @@ -36,6 +36,12 @@ std::atomic client_started = false; */ bool is_azlogin_required = false; +/* + * Should fetch a new token? + * A token should be fetched only once per mount. + */ +static bool shouldFetchToken = true; + /* * Stores the error string to be returned to the mount program over the status pipe. */ @@ -632,6 +638,8 @@ auth_token_cb_res *get_auth_token_and_setargs_cb(struct auth_context *auth) assert(expirytime >= static_cast(time(NULL))); cb_res->expiry_time = expirytime; + shouldFetchToken = false; + return cb_res; } @@ -833,8 +841,10 @@ int main(int argc, char *argv[]) } if (aznfsc_cfg.auth) { - // Set the auth token callback for this connection if auth is enabled. - set_auth_token_callback(get_auth_token_and_setargs_cb); + // Set the auth token callback to fetch a new token. + if (shouldFetchToken) { + set_auth_token_callback(get_auth_token_and_setargs_cb); + } } else { set_auth_token_callback(get_auth_token_and_setargs_cb_none); }