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 2014/01/03 18:18:37 UTC

[06/50] git commit: TS-2448: Fix traffic_manager to work correctly if proxy.config.local_state_dir is set

TS-2448: Fix traffic_manager to work correctly if proxy.config.local_state_dir is set


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/aae02ee4
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/aae02ee4
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/aae02ee4

Branch: refs/heads/5.0.x
Commit: aae02ee4fd133ec604b3e7bd7d090cd05f29750e
Parents: b78aa56
Author: James Peach <jp...@apache.org>
Authored: Mon Dec 16 15:53:43 2013 -0800
Committer: James Peach <jp...@apache.org>
Committed: Fri Dec 20 15:23:14 2013 -0800

----------------------------------------------------------------------
 lib/records/RecCore.cc    | 3 ++-
 lib/records/RecMessage.cc | 3 ++-
 mgmt/LocalManager.cc      | 3 ++-
 mgmt/Main.cc              | 5 +++--
 mgmt/api/CoreAPIRemote.cc | 2 ++
 5 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aae02ee4/lib/records/RecCore.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc
index 759dcef..b81b3d1 100644
--- a/lib/records/RecCore.cc
+++ b/lib/records/RecCore.cc
@@ -177,7 +177,8 @@ RecCoreInit(RecModeT mode_type, Diags *_diags)
   }
   // read stats
   if ((mode_type == RECM_SERVER) || (mode_type == RECM_STAND_ALONE)) {
-    g_stats_snap_fpath = Layout::relative_to(Layout::get()->runtimedir, REC_RAW_STATS_FILE);
+    xptr<char> rundir(RecConfigReadRuntimeDir());
+    g_stats_snap_fpath = Layout::relative_to(rundir, REC_RAW_STATS_FILE);
     RecReadStatsFile();
   }
   // read configs

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aae02ee4/lib/records/RecMessage.cc
----------------------------------------------------------------------
diff --git a/lib/records/RecMessage.cc b/lib/records/RecMessage.cc
index 8c84c8b..bec22be 100644
--- a/lib/records/RecMessage.cc
+++ b/lib/records/RecMessage.cc
@@ -99,8 +99,9 @@ recv_thr(void *data)
 static void *
 accept_thr(void *data)
 {
+  xptr<char> rundir(RecConfigReadRuntimeDir());
   RecHandle h_pipe;
-  h_pipe = RecPipeCreate(Layout::get()->runtimedir, REC_PIPE_NAME);
+  h_pipe = RecPipeCreate(rundir, REC_PIPE_NAME);
   ink_thread_create(send_thr, (void *) h_pipe);
   ink_thread_create(recv_thr, (void *) h_pipe);
   return NULL;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aae02ee4/mgmt/LocalManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc
index 21d05e6..dc30dcd 100644
--- a/mgmt/LocalManager.cc
+++ b/mgmt/LocalManager.cc
@@ -146,7 +146,8 @@ LocalManager::clearStats(const char *name)
   //   that operation works even when the proxy is off
   //
   if (this->proxy_running == 0) {
-    statsPath = Layout::relative_to(Layout::get()->runtimedir, REC_RAW_STATS_FILE);
+    xptr<char> rundir(RecConfigReadRuntimeDir());
+    statsPath = Layout::relative_to(rundir, REC_RAW_STATS_FILE);
     if (unlink(statsPath) < 0) {
       if (errno != ENOENT) {
         mgmt_log(stderr, "[LocalManager::clearStats] Unlink of %s failed : %s\n", REC_RAW_STATS_FILE, strerror(errno));

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aae02ee4/mgmt/Main.cc
----------------------------------------------------------------------
diff --git a/mgmt/Main.cc b/mgmt/Main.cc
index 2452f16..ac23d21 100644
--- a/mgmt/Main.cc
+++ b/mgmt/Main.cc
@@ -104,6 +104,7 @@ static void SigChldHandler(int sig);
 static void
 check_lockfile()
 {
+  xptr<char> rundir(RecConfigReadRuntimeDir());
   char lockfile[PATH_NAME_MAX];
   int err;
   pid_t holding_pid;
@@ -111,7 +112,7 @@ check_lockfile()
   //////////////////////////////////////
   // test for presence of server lock //
   //////////////////////////////////////
-  Layout::relative_to(lockfile, PATH_NAME_MAX, Layout::get()->runtimedir, SERVER_LOCK);
+  Layout::relative_to(lockfile, sizeof(lockfile), rundir, SERVER_LOCK);
   Lockfile server_lockfile(lockfile);
   err = server_lockfile.Open(&holding_pid);
   if (err == 1) {
@@ -137,7 +138,7 @@ check_lockfile()
   ///////////////////////////////////////////
   // try to get the exclusive manager lock //
   ///////////////////////////////////////////
-  Layout::relative_to(lockfile, PATH_NAME_MAX, Layout::get()->runtimedir, MANAGER_LOCK);
+  Layout::relative_to(lockfile, sizeof(lockfile), rundir, MANAGER_LOCK);
   Lockfile manager_lockfile(lockfile);
   err = manager_lockfile.Get(&holding_pid);
   if (err != 1) {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/aae02ee4/mgmt/api/CoreAPIRemote.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPIRemote.cc b/mgmt/api/CoreAPIRemote.cc
index cb2ae5c..6c0ecc3 100644
--- a/mgmt/api/CoreAPIRemote.cc
+++ b/mgmt/api/CoreAPIRemote.cc
@@ -237,6 +237,8 @@ Init(const char *socket_path, TSInitOptionT options)
 
   ts_init_options = options;
 
+  // XXX This should use RecConfigReadRuntimeDir(), but that's not linked into the management
+  // libraries. The caller has to pass down the right socket path :(
   if (!socket_path) {
     Layout::create();
     socket_path = Layout::get()->runtimedir;