Skip to content

Commit

Permalink
Fix repetitive output
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaSBrown committed Jan 24, 2025
1 parent 2d6ad4a commit b389af3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
10 changes: 7 additions & 3 deletions repository/gridftp/globus5/authz/source/AuthzWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ std::string AuthzWorker::getAuthzPath(char *full_ftp_path) {
int AuthzWorker::processResponse(ICommunicator::Response &response) {
if (response.message) { // Make sure the message exists before we try to
// access it

// Prefer the correlation id of the received message than the one that
// was originally sent
m_log_context.correlation_id = std::get<std::string>(
response.message->get(MessageAttribute::CORRELATION_ID));
}
Expand Down Expand Up @@ -586,10 +589,11 @@ int AuthzWorker::checkAuth(char *client_id, char *path, char *action) {
m_cred_options[CredentialType::PUBLIC_KEY]);
message->setPayload(std::move(auth_req));

m_comm->send(*message);
LogContext log_context = m_log_context;
log_context.correlation_id =
m_log_context.correlation_id =
std::get<std::string>(message->get(MessageAttribute::CORRELATION_ID));
DL_INFO(m_log_context,
"Sending RepoAuthzRequest client_id: " << client_id << " path: " << path << " action: " << action );
m_comm->send(*message);

auto response = m_comm->receive(MessageType::GOOGLE_PROTOCOL_BUFFER);

Expand Down
20 changes: 16 additions & 4 deletions repository/gridftp/globus5/authz/source/Config.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ static struct Config g_config;
// already been initialized
static bool config_loaded = false;

// Used to control the output of log messages and prevent initialization
// messaged from reappearing
static bool first_run = true;

// Initialize the read-write lock for the configuration object
pthread_rwlock_t config_rwlock = PTHREAD_RWLOCK_INITIALIZER;

Expand Down Expand Up @@ -339,11 +343,19 @@ bool validateConfig() {
return true;
}

/**
* Will print the version information first go around..
*
* @note Assumes you have a thread lock in play
**/
void logRelease() {
AUTHZ_LOG_INFO("DataFed Authz module started, version %s\n", getVersion());
AUTHZ_LOG_INFO(" API, version %s\n", getAPIVersion());
AUTHZ_LOG_INFO(" Release, version %s\n",
getReleaseVersion());
if(first_run) {
AUTHZ_LOG_INFO("DataFed Authz module started, version %s\n", getVersion());
AUTHZ_LOG_INFO(" API, version %s\n", getAPIVersion());
AUTHZ_LOG_INFO(" Release, version %s\n",
getReleaseVersion());
first_run = false;
}
}

/******************************************************************************
Expand Down

0 comments on commit b389af3

Please sign in to comment.