Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions turbonfs/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ std::atomic<bool> 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.
*/
Expand Down Expand Up @@ -632,6 +638,8 @@ auth_token_cb_res *get_auth_token_and_setargs_cb(struct auth_context *auth)
assert(expirytime >= static_cast<uint64_t>(time(NULL)));
cb_res->expiry_time = expirytime;

shouldFetchToken = false;

return cb_res;
}

Expand Down Expand Up @@ -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);
}
Expand Down