You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2016/05/02 18:08:17 UTC

[trafficserver] 01/04: TS-4380: Move ProxyShutdown to CoreAPI.cc.

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

jpeach pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 346b5465af6791c81dd1ce91e41384917592884e
Author: James Peach <jp...@apache.org>
AuthorDate: Sat Apr 30 09:33:29 2016 -0700

    TS-4380: Move ProxyShutdown to CoreAPI.cc.
    
    ProxyShutdown is only used in one place, so there's no need for a
    global symbol. Move it locally and make it static.
---
 mgmt/WebMgmtUtils.cc | 32 --------------------------------
 mgmt/WebMgmtUtils.h  |  2 --
 mgmt/api/CoreAPI.cc  | 34 +++++++++++++++++++++++++++++++++-
 3 files changed, 33 insertions(+), 35 deletions(-)

diff --git a/mgmt/WebMgmtUtils.cc b/mgmt/WebMgmtUtils.cc
index 2392102..429ba9e 100644
--- a/mgmt/WebMgmtUtils.cc
+++ b/mgmt/WebMgmtUtils.cc
@@ -1011,38 +1011,6 @@ substituteForHTMLChars(const char *buffer)
   return safeBuf;
 }
 
-// bool ProxyShutdown()
-//
-//  Attempts to turn the proxy off.  Returns
-//    true if the proxy is off when the call returns
-//    and false if it is still on
-//
-bool
-ProxyShutdown()
-{
-  int i = 0;
-
-  // Check to make sure that we are not already down
-  if (!lmgmt->processRunning()) {
-    return true;
-  }
-  // Send the shutdown event
-  lmgmt->signalEvent(MGMT_EVENT_SHUTDOWN, "shutdown");
-
-  // Wait for awhile for shtudown to happen
-  do {
-    mgmt_sleep_sec(1);
-    i++;
-  } while (i < 10 && lmgmt->processRunning());
-
-  // See if we succeeded
-  if (lmgmt->processRunning()) {
-    return false;
-  } else {
-    return true;
-  }
-}
-
 //
 //
 //  Sets the LocalManager variable:  proxy.node.hostname
diff --git a/mgmt/WebMgmtUtils.h b/mgmt/WebMgmtUtils.h
index a29c1c1..6b27f2b 100644
--- a/mgmt/WebMgmtUtils.h
+++ b/mgmt/WebMgmtUtils.h
@@ -98,8 +98,6 @@ char *substituteForHTMLChars(const char *buffer);
 InkHashTable *processFormSubmission(char *submission);
 InkHashTable *processFormSubmission_noSubstitute(char *submission);
 
-// Shutdown the proxy
-bool ProxyShutdown();
 int setHostnameVar();
 void appendDefaultDomain(char *hostname, int bufLength);
 
diff --git a/mgmt/api/CoreAPI.cc b/mgmt/api/CoreAPI.cc
index ed5e3ea..1fe0707 100644
--- a/mgmt/api/CoreAPI.cc
+++ b/mgmt/api/CoreAPI.cc
@@ -142,6 +142,38 @@ DiagnosticMessage(TSDiagsT mode, const char *fmt, va_list ap)
 /***************************************************************************
  * Control Operations
  ***************************************************************************/
+
+// bool ProxyShutdown()
+//
+//  Attempts to turn the proxy off.  Returns
+//    true if the proxy is off when the call returns
+//    and false if it is still on
+//
+static bool
+ProxyShutdown()
+{
+  int i = 0;
+
+  // Check to make sure that we are not already down
+  if (!lmgmt->processRunning()) {
+    return true;
+  }
+
+  lmgmt->processShutdown(false /* only shut down the proxy*/);
+
+  // Wait for awhile for shtudown to happen
+  do {
+    mgmt_sleep_sec(1);
+    i++;
+  } while (i < 10 && lmgmt->processRunning());
+
+  // See if we succeeded
+  if (lmgmt->processRunning()) {
+    return false;
+  } else {
+    return true;
+  }
+}
 /*-------------------------------------------------------------------------
  * ProxyStateGet
  *-------------------------------------------------------------------------
@@ -161,7 +193,7 @@ ProxyStateGet()
  * ProxyStateSet
  *-------------------------------------------------------------------------
  * If state == TS_PROXY_ON, will turn on TS (unless it's already running).
- * If steat == TS_PROXY_OFF, will turn off TS (unless it's already off).
+ * If state == TS_PROXY_OFF, will turn off TS (unless it's already off).
  * tsArgs  - (optional) a string with space delimited options that user
  *            wants to start traffic Server with
  */

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.