You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2019/06/15 16:22:48 UTC

[trafficserver] 18/23: Step 18: Removes setLastModifiedTime, and simplifies code

This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit e336562b2a2215144aae25e3fc26579a1daac380
Author: Leif Hedstrom <zw...@apache.org>
AuthorDate: Mon May 27 14:37:29 2019 -0600

    Step 18: Removes setLastModifiedTime, and simplifies code
---
 mgmt/Rollback.cc | 26 +-------------------------
 mgmt/Rollback.h  | 11 -----------
 2 files changed, 1 insertion(+), 36 deletions(-)

diff --git a/mgmt/Rollback.cc b/mgmt/Rollback.cc
index c33d0d8..fc1372d 100644
--- a/mgmt/Rollback.cc
+++ b/mgmt/Rollback.cc
@@ -74,12 +74,6 @@ Rollback::Rollback(const char *fileName_, const char *configName_, bool root_acc
 
   ink_mutex_init(&fileAccessLock);
 
-  // ToDo: This was really broken before, it  used to check if numberBackups <=0, but that could never happen.
-  if (flags & CONFIG_FLAG_UNVERSIONED) {
-    setLastModifiedTime();
-    return;
-  }
-
   // Check to make sure that our configuration file exists
   //
   if (statFile(&fileInfo) < 0) {
@@ -114,24 +108,6 @@ Rollback::statFile(struct stat *buf)
   return statResult;
 }
 
-bool
-Rollback::setLastModifiedTime()
-{
-  struct stat fileInfo;
-
-  // Now we need to get the modification time off of the new active file
-  if (statFile(&fileInfo) >= 0) {
-    fileLastModified = TS_ARCHIVE_STAT_MTIME(fileInfo);
-    return true;
-  } else {
-    // We really shouldn't fail to stat the file since we just
-    //  created it.  If we do, just punt and just use the current
-    //  time.
-    fileLastModified = (time(nullptr) - ink_timezone()) * 1000000000;
-    return false;
-  }
-}
-
 // bool Rollback::checkForUserUpdate()
 //
 //  Called to check if the file has been changed  by the user.
@@ -150,7 +126,7 @@ Rollback::checkForUserUpdate()
   }
 
   if (fileLastModified < TS_ARCHIVE_STAT_MTIME(fileInfo)) {
-    setLastModifiedTime();
+    fileLastModified = TS_ARCHIVE_STAT_MTIME(fileInfo);
     configFiles->fileChanged(fileName, configName, true);
     mgmt_log("User has changed config file %s\n", fileName);
 
diff --git a/mgmt/Rollback.h b/mgmt/Rollback.h
index e58db4a..e8ec017 100644
--- a/mgmt/Rollback.h
+++ b/mgmt/Rollback.h
@@ -29,18 +29,8 @@
 class FileManager;
 class TextBuffer;
 
-typedef int version_t;
-
 class ExpandingArray;
 
-// Stores info about a backup version
-//   Can be put in to List.h lists
-struct versionInfo {
-  version_t version;
-  time_t modTime;
-  LINK(versionInfo, link);
-};
-
 //
 //  class Rollback
 //
@@ -78,7 +68,6 @@ public:
 
   // Automatically take out lock
   bool checkForUserUpdate();
-  bool setLastModifiedTime();
 
   // Not file based so no lock necessary
   const char *