MCPcopy Create free account
hub / github.com/apache/trafficserver / checkForUserUpdate

Method checkForUserUpdate

src/mgmt/config/FileManager.cc:386–411  ·  view source on GitHub ↗

bool ConfigManager::checkForUserUpdate(RollBackCheckType how) Called to check if the file has been changed by the user. Timestamps are compared to see if a change occurred

Source from the content-addressed store, hash-verified

384// Called to check if the file has been changed by the user.
385// Timestamps are compared to see if a change occurred
386bool
387FileManager::ConfigManager::checkForUserUpdate(FileManager::RollBackCheckType how)
388{
389 struct stat fileInfo;
390 bool result;
391
392 ink_mutex_acquire(&fileAccessLock);
393
394 if (this->statFile(&fileInfo) < 0) {
395 ink_mutex_release(&fileAccessLock);
396 return false;
397 }
398
399 if (fileLastModified < TS_ARCHIVE_STAT_MTIME(fileInfo)) {
400 if (how == FileManager::ROLLBACK_CHECK_AND_UPDATE) {
401 fileLastModified = TS_ARCHIVE_STAT_MTIME(fileInfo);
402 // TODO: syslog????
403 }
404 result = true;
405 } else {
406 result = false;
407 }
408
409 ink_mutex_release(&fileAccessLock);
410 return result;
411}

Callers 2

rereadConfigMethod · 0.80
isConfigStaleMethod · 0.80

Calls 3

statFileMethod · 0.95
ink_mutex_acquireFunction · 0.85
ink_mutex_releaseFunction · 0.85

Tested by

no test coverage detected