Repository: trafficserver Updated Branches: refs/heads/master 0c8f9343c -> a2584bf29
TS-2976: lib records build cleanup Use the correct constant for MGMT_SIGNAL_SAC_SERVER_DOWN. Remove REC_SignalManager compatibility define. Replace REC_SignalWarning and REC_SignalError macros with RecSignalWarning. Remove the LOCAL_MANAGER and PROCESS_MANAGER defines. With this change, we no longer compile any code differently depending on the LOCAL_MANAGER and PROCESS_MANAGER defines. Where we build libraries that have local and process variants, we just stub a small set of symbols to do the right thing. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/a2584bf2 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/a2584bf2 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/a2584bf2 Branch: refs/heads/master Commit: a2584bf29cf0945a33c3bdd1c35c0322aba96315 Parents: 0c8f934 Author: James Peach <[email protected]> Authored: Mon Jul 28 15:35:53 2014 -0700 Committer: James Peach <[email protected]> Committed: Wed Jul 30 11:49:32 2014 -0700 ---------------------------------------------------------------------- CHANGES | 2 + configure.ac | 3 -- iocore/aio/test_AIO.cc | 1 - iocore/cache/Cache.cc | 8 ++-- iocore/cache/CacheHosting.cc | 54 +++++++----------------- iocore/cache/Store.cc | 13 ++---- iocore/cluster/ClusterHandlerBase.cc | 4 +- iocore/hostdb/MultiCache.cc | 6 +-- iocore/net/P_UnixNet.h | 6 +-- iocore/net/SSLUtils.cc | 9 +--- lib/records/I_RecCore.h | 26 +++++------- lib/records/Makefile.am | 4 -- lib/records/P_RecMessage.h | 1 + lib/records/RecCore.cc | 66 ++++++++++++----------------- lib/records/RecLocal.cc | 48 ++++++++++++++++++++- lib/records/RecMessage.cc | 48 +-------------------- lib/records/RecProcess.cc | 49 ++++++++++++++++++++-- mgmt/Alarms.h | 2 +- mgmt/BaseManager.h | 2 +- mgmt/LocalManager.cc | 2 +- mgmt/Main.cc | 3 -- mgmt/ProcessManager.cc | 1 - mgmt/ProcessManager.h | 3 -- mgmt/api/CoreAPI.cc | 4 +- mgmt/api/TSControlMain.cc | 4 +- mgmt/utils/Makefile.am | 3 +- mgmt/utils/MgmtLocalCleanup.cc | 33 +++++++++++++++ mgmt/utils/MgmtProcessCleanup.cc | 30 +++++++++++++ mgmt/utils/MgmtUtils.cc | 67 +++--------------------------- proxy/ICP.cc | 27 ++++-------- proxy/ICPConfig.cc | 54 ++++++++---------------- proxy/congest/Congestion.cc | 2 - proxy/logging/LogCollationClientSM.cc | 2 +- proxy/logging/LogStandalone.cc | 3 -- proxy/logging/LogUtils.cc | 5 +-- 35 files changed, 271 insertions(+), 324 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index 1295f23..1e82252 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ -*- coding: utf-8 -*- Changes with Apache Traffic Server 5.1.0 + *) [TS-2976] Perform some librecords build cleanup. + *) [TS-2975] Add cache lookup status support to the xdebug plugin. *) [TS-2974] Add a new metrics plugin to support the Epic monitoring system. http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/configure.ac ---------------------------------------------------------------------- diff --git a/configure.ac b/configure.ac index b1b4cef..75ca84b 100644 --- a/configure.ac +++ b/configure.ac @@ -221,9 +221,6 @@ TS_ARG_ENABLE_VAR([has], [tests]) AC_SUBST(has_tests) AM_CONDITIONAL([BUILD_TESTS], [test 0 -ne $has_tests]) -AC_SUBST([ink_with_modules_local],["-DLOCAL_MANAGER"]) -AC_SUBST([ink_with_modules_process],["-DPROCESS_MANAGER"]) - # # Force some static linkage (for testing / development only) # http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/iocore/aio/test_AIO.cc ---------------------------------------------------------------------- diff --git a/iocore/aio/test_AIO.cc b/iocore/aio/test_AIO.cc index a275fb6..c9d7a9c 100644 --- a/iocore/aio/test_AIO.cc +++ b/iocore/aio/test_AIO.cc @@ -31,7 +31,6 @@ using std::cout; using std::endl; Diags *diags; -int diags_init = 0; #define DIAGS_LOG_FILE "diags.log" // Necessary for AIO http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/iocore/cache/Cache.cc ---------------------------------------------------------------------- diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc index 64a0d7a..03a3650 100644 --- a/iocore/cache/Cache.cc +++ b/iocore/cache/Cache.cc @@ -2198,12 +2198,12 @@ AIO_Callback_handler::handle_disk_failure(int /* event ATS_UNUSED */, void *data if (!DISK_BAD(d)) { snprintf(message, sizeof(message), "Error accessing Disk %s [%d/%d]", d->path, d->num_errors, cache_config_max_disk_errors); Warning("%s", message); - REC_SignalManager(REC_SIGNAL_CACHE_WARNING, message); + RecSignalManager(REC_SIGNAL_CACHE_WARNING, message); } else if (!DISK_BAD_SIGNALLED(d)) { snprintf(message, sizeof(message), "too many errors [%d] accessing disk %s: declaring disk bad", d->num_errors, d->path); Warning("%s", message); - REC_SignalManager(REC_SIGNAL_CACHE_ERROR, message); + RecSignalManager(REC_SIGNAL_CACHE_ERROR, message); good_interim_disks--; } } @@ -2220,11 +2220,11 @@ AIO_Callback_handler::handle_disk_failure(int /* event ATS_UNUSED */, void *data if (!DISK_BAD(d)) { snprintf(message, sizeof(message), "Error accessing Disk %s [%d/%d]", d->path, d->num_errors, cache_config_max_disk_errors); Warning("%s", message); - REC_SignalManager(REC_SIGNAL_CACHE_WARNING, message); + RecSignalManager(REC_SIGNAL_CACHE_WARNING, message); } else if (!DISK_BAD_SIGNALLED(d)) { snprintf(message, sizeof(message), "too many errors accessing disk %s [%d/%d]: declaring disk bad", d->path, d->num_errors, cache_config_max_disk_errors); Warning("%s", message); - REC_SignalManager(REC_SIGNAL_CACHE_ERROR, message); + RecSignalManager(REC_SIGNAL_CACHE_ERROR, message); cacheProcessor.mark_storage_offline(d); // take it out of service } break; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/iocore/cache/CacheHosting.cc ---------------------------------------------------------------------- diff --git a/iocore/cache/CacheHosting.cc b/iocore/cache/CacheHosting.cc index 66f3b0d..2d2f3b2 100644 --- a/iocore/cache/CacheHosting.cc +++ b/iocore/cache/CacheHosting.cc @@ -30,9 +30,6 @@ matcher_tags CacheHosting_tags = { "hostname", "domain" }; - -bool alarmAlready = false; - /************************************************************* * Begin class HostMatcher *************************************************************/ @@ -271,7 +268,6 @@ CacheHostTable::BuildTableFromString(const char * config_file_path, char *file_b int line_num = 0; int second_pass = 0; int numEntries = 0; - char errBuf[1024]; const char *errPtr = NULL; // type counts @@ -302,9 +298,8 @@ CacheHostTable::BuildTableFromString(const char * config_file_path, char *file_b errPtr = parseConfigLine((char *) tmp, current, config_tags); if (errPtr != NULL) { - snprintf(errBuf, sizeof(errBuf), "%s discarding %s entry at line %d : %s", + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : %s", matcher_name, config_file_path, line_num, errPtr); - REC_SignalError(errBuf, alarmAlready); ats_free(current); } else { @@ -385,9 +380,8 @@ CacheHostTable::BuildTableFromString(const char * config_file_path, char *file_b hostMatch->NewEntry(current); } } else { - snprintf(errBuf, sizeof(errBuf), "%s discarding %s entry with unknown type at line %d", + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry with unknown type at line %d", matcher_name, config_file_path, current->line_num); - REC_SignalError(errBuf, alarmAlready); } // Deallocate the parsing structure @@ -398,10 +392,9 @@ CacheHostTable::BuildTableFromString(const char * config_file_path, char *file_b if (!generic_rec_initd) { const char *cache_type = (type == CACHE_HTTP_TYPE) ? "http" : "mixt"; - snprintf(errBuf, sizeof(errBuf), + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "No Volumes specified for Generic Hostnames for %s documents: %s cache will be disabled", cache_type, cache_type); - REC_SignalError(errBuf, alarmAlready); } ink_assert(second_pass == numEntries); @@ -438,9 +431,7 @@ CacheHostRecord::Init(CacheType typ) int i, j; extern Queue<CacheVol> cp_list; extern int cp_list_len; - char err[1024]; - err[0] = 0; num_vols = 0; type = typ; cp = (CacheVol **)ats_malloc(cp_list_len * sizeof(CacheVol *)); @@ -456,8 +447,7 @@ CacheHostRecord::Init(CacheType typ) } } if (!num_cachevols) { - snprintf(err, 1024, "error: No volumes found for Cache Type %d\n", type); - REC_SignalError(err, alarmAlready); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "error: No volumes found for Cache Type %d", type); return -1; } vols = (Vol **)ats_malloc(num_vols * sizeof(Vol *)); @@ -479,8 +469,6 @@ CacheHostRecord::Init(matcher_line * line_info, CacheType typ) { int i, j; extern Queue<CacheVol> cp_list; - char err[1024]; - err[0] = 0; int is_vol_present = 0; char config_file[PATH_NAME_MAX]; @@ -507,10 +495,9 @@ CacheHostRecord::Init(matcher_line * line_info, CacheType typ) s++; if (!(*s)) { const char *errptr = "A volume number expected"; - snprintf(err, 1024, + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d :%s", "[CacheHosting]", config_file, line_info->line_num, errptr); - REC_SignalError(err, alarmAlready); if (val != NULL) { ats_free(val); } @@ -518,10 +505,9 @@ CacheHostRecord::Init(matcher_line * line_info, CacheType typ) } } if ((*s<'0') || (*s> '9')) { - snprintf(err, 1024, + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : bad token [%c]", "[CacheHosting]", config_file, line_info->line_num, *s); - REC_SignalError(err, alarmAlready); if (val != NULL) { ats_free(val); } @@ -556,10 +542,9 @@ CacheHostRecord::Init(matcher_line * line_info, CacheType typ) } } if (!is_vol_present) { - snprintf(err, 1024, + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : bad volume number [%d]", "[CacheHosting]", config_file, line_info->line_num, volume_number); - REC_SignalError(err, alarmAlready); if (val != NULL) { ats_free(val); } @@ -577,18 +562,16 @@ CacheHostRecord::Init(matcher_line * line_info, CacheType typ) break; } - snprintf(err, 1024, + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : bad token [%s]", "[CacheHosting]", config_file, line_info->line_num, label); - REC_SignalError(err, alarmAlready); return -1; } if (i == MATCHER_MAX_TOKENS) { - snprintf(err, 1024, + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : No volumes specified", "[CacheHosting]", config_file, line_info->line_num); - REC_SignalError(err, alarmAlready); return -1; } @@ -661,11 +644,9 @@ ConfigVolumes::BuildListFromString(char *config_file_path, char *file_buf) char *line_end = NULL; int line_num = 0; int total = 0; //added by YTS Team, yamsat for bug id 59632 - char errBuf[1024]; char volume_seen[256]; int state = 0; //changed by YTS Team, yamsat for bug id 59632 - int manager_alarmed = false; int volume_number = 0; CacheType scheme = CACHE_NONE_TYPE; int size = 0; @@ -724,10 +705,8 @@ ConfigVolumes::BuildListFromString(char *config_file_path, char *file_buf) break; } else { if (!(*tmp)) { - snprintf(errBuf, sizeof(errBuf), "%s discarding %s entry at line %d : Unexpected end of line", + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : Unexpected end of line", matcher_name, config_file_path, line_num); - REC_SignalError(errBuf, manager_alarmed); - break; } } @@ -768,9 +747,8 @@ ConfigVolumes::BuildListFromString(char *config_file_path, char *file_buf) err = "Volume Already Specified"; } - snprintf(errBuf, sizeof(errBuf), "%s discarding %s entry at line %d : %s [%d]", + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : %s [%d]", matcher_name, config_file_path, line_num, err, volume_number); - REC_SignalError(errBuf, manager_alarmed); state = INK_ERROR; break; } @@ -820,9 +798,8 @@ ConfigVolumes::BuildListFromString(char *config_file_path, char *file_buf) if (size > 100 || total > 100) { state = INK_ERROR_VOLUME; if (state == INK_ERROR_VOLUME || *tmp) { - snprintf(errBuf, sizeof(errBuf), + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "Total volume size added upto more than 100 percent,No volumes created"); - REC_SignalError(errBuf, manager_alarmed); break; } } @@ -837,16 +814,13 @@ ConfigVolumes::BuildListFromString(char *config_file_path, char *file_buf) } if (state == INK_ERROR || *tmp) { - snprintf(errBuf, sizeof(errBuf), "%s discarding %s entry at line %d : Invalid token [%s]", + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s discarding %s entry at line %d : Invalid token [%s]", matcher_name, config_file_path, line_num, tmp); - REC_SignalError(errBuf, manager_alarmed); - break; } //added by YTS Team, yamsat for bug id 59632 if (state == INK_ERROR_VOLUME || *tmp) { - snprintf(errBuf, sizeof(errBuf), "Total volume size added upto more than 100 percent,No volumes created"); - REC_SignalError(errBuf, manager_alarmed); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "Total volume size added upto more than 100 percent,No volumes created"); break; } // ends here http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/iocore/cache/Store.cc ---------------------------------------------------------------------- diff --git a/iocore/cache/Store.cc b/iocore/cache/Store.cc index 3f41808..f86c16b 100644 --- a/iocore/cache/Store.cc +++ b/iocore/cache/Store.cc @@ -361,10 +361,8 @@ Store::read_config(int fd) Debug("cache_init", "Store::read_config - ns = new Span; ns->init(\"%s\",%" PRId64 "), ns->vol_num=%d", pp, size, ns->vol_num); if ((err = ns->init(pp, size))) { - char buf[4096]; - snprintf(buf, sizeof(buf), "could not initialize storage \"%s\" [%s]", pp, err); - REC_SignalWarning(REC_SIGNAL_SYSTEM_ERROR, buf); - Debug("cache_init", "Store::read_config - %s", buf); + RecSignalWarning(REC_SIGNAL_SYSTEM_ERROR, "could not initialize storage \"%s\" [%s]", pp, err); + Debug("cache_init", "Store::read_config - could not initialize storage \"%s\" [%s]", pp, err); delete ns; ats_free(pp); continue; @@ -425,11 +423,8 @@ Store::read_interim_config() { n[len] = '\0'; ns = new Span; if ((err = ns->init(n, -1))) { - char buf[4096]; - snprintf(buf, sizeof(buf), "could not initialize storage \"%s\" [%s]", n, - err); - REC_SignalWarning(REC_SIGNAL_SYSTEM_ERROR, buf); - Debug("cache_init", "Store::read_interim_config - %s", buf); + RecSignalWarning(REC_SIGNAL_SYSTEM_ERROR, "could not initialize storage \"%s\" [%s]", n, err); + Debug("cache_init", "Store::read_interim_config - could not initialize storage \"%s\" [%s]", n, err); delete ns; continue; } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/iocore/cluster/ClusterHandlerBase.cc ---------------------------------------------------------------------- diff --git a/iocore/cluster/ClusterHandlerBase.cc b/iocore/cluster/ClusterHandlerBase.cc index df81f0a..7573ac0 100644 --- a/iocore/cluster/ClusterHandlerBase.cc +++ b/iocore/cluster/ClusterHandlerBase.cc @@ -735,7 +735,7 @@ ClusterHandler::machine_down() #endif machine_offline_APIcallout(ip); snprintf(textbuf, sizeof(textbuf), "%hhu.%hhu.%hhu.%hhu:%d", DOT_SEPARATED(ip), port); - REC_SignalManager(REC_SIGNAL_MACHINE_DOWN, textbuf); + RecSignalManager(REC_SIGNAL_MACHINE_DOWN, textbuf); if (net_vc) { net_vc->do_io(VIO::CLOSE); net_vc = 0; @@ -1126,7 +1126,7 @@ failed: // Signal the manager snprintf(textbuf, sizeof(textbuf), "%hhu.%hhu.%hhu.%hhu:%d", DOT_SEPARATED(ip), port); - REC_SignalManager(REC_SIGNAL_MACHINE_UP, textbuf); + RecSignalManager(REC_SIGNAL_MACHINE_UP, textbuf); #ifdef LOCAL_CLUSTER_TEST_MODE Note("machine up %hhu.%hhu.%hhu.%hhu:%d, protocol version=%d.%d", DOT_SEPARATED(ip), port, clusteringVersion._major, clusteringVersion._minor); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/iocore/hostdb/MultiCache.cc ---------------------------------------------------------------------- diff --git a/iocore/hostdb/MultiCache.cc b/iocore/hostdb/MultiCache.cc index cafa05c..108c4f4 100644 --- a/iocore/hostdb/MultiCache.cc +++ b/iocore/hostdb/MultiCache.cc @@ -732,16 +732,14 @@ Lfail: { unmap_data(); if (!silent) { - char msg[PATH_NAME_MAX + 1024]; if (reconfigure) { - snprintf(msg, PATH_NAME_MAX + 1024, "%s: [%s] %s: disabling database\n" + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s: [%s] %s: disabling database\n" "You may need to 'reconfigure' your cache manually. Please refer to\n" "the 'Configuration' chapter in the manual.", err, config_filename, serr ? serr : ""); } else { - snprintf(msg, PATH_NAME_MAX + 1024, "%s: [%s] %s: reinitializing database", err, config_filename, + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s: [%s] %s: reinitializing database", err, config_filename, serr ? serr : ""); } - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, msg); } } ret = -1; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/iocore/net/P_UnixNet.h ---------------------------------------------------------------------- diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h index 5d52dce..1868055 100644 --- a/iocore/net/P_UnixNet.h +++ b/iocore/net/P_UnixNet.h @@ -246,7 +246,7 @@ check_shedding_warning() ink_hrtime t = ink_get_hrtime(); if (t - last_shedding_warning > NET_THROTTLE_MESSAGE_EVERY) { last_shedding_warning = t; - REC_SignalWarning(REC_SIGNAL_SYSTEM_ERROR, "number of connections reaching shedding limit"); + RecSignalWarning(REC_SIGNAL_SYSTEM_ERROR, "number of connections reaching shedding limit"); } } @@ -276,7 +276,7 @@ check_throttle_warning() ink_hrtime t = ink_get_hrtime(); if (t - last_throttle_warning > NET_THROTTLE_MESSAGE_EVERY) { last_throttle_warning = t; - REC_SignalWarning(REC_SIGNAL_SYSTEM_ERROR, "too many connections, throttling"); + RecSignalWarning(REC_SIGNAL_SYSTEM_ERROR, "too many connections, throttling"); } } @@ -300,7 +300,7 @@ check_emergency_throttle(Connection & con) if (fd > emergency) { int over = fd - emergency; emergency_throttle_time = ink_get_hrtime() + (over * over) * HRTIME_SECOND; - REC_SignalWarning(REC_SIGNAL_SYSTEM_ERROR, "too many open file descriptors, emergency throttling"); + RecSignalWarning(REC_SIGNAL_SYSTEM_ERROR, "too many open file descriptors, emergency throttling"); int hyper_emergency = fds_limit - HYPER_EMERGENCY_THROTTLE; if (fd > hyper_emergency) con.close(); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/iocore/net/SSLUtils.cc ---------------------------------------------------------------------- diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc index 1970036..db141e3 100644 --- a/iocore/net/SSLUtils.cc +++ b/iocore/net/SSLUtils.cc @@ -1417,9 +1417,6 @@ SSLParseCertificateConfiguration( unsigned line_num = 0; matcher_line line_info; - bool alarmAlready = false; - char errBuf[1024]; - const matcher_tags sslCertTags = { NULL, NULL, NULL, NULL, NULL, NULL, false }; @@ -1457,9 +1454,8 @@ SSLParseCertificateConfiguration( errPtr = parseConfigLine(line, &line_info, &sslCertTags); if (errPtr != NULL) { - snprintf(errBuf, sizeof(errBuf), "%s: discarding %s entry at line %d: %s", + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s: discarding %s entry at line %d: %s", __func__, params->configFilePath, line_num, errPtr); - REC_SignalError(errBuf, alarmAlready); } else { if (ssl_extract_certificate(&line_info, sslMultiCertSettings)) { if (!ssl_store_ssl_context(params, lookup, sslMultiCertSettings)) { @@ -1467,9 +1463,8 @@ SSLParseCertificateConfiguration( params->configFilePath, line_num); } } else { - snprintf(errBuf, sizeof(errBuf), "%s: discarding invalid %s entry at line %u", + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "%s: discarding invalid %s entry at line %u", __func__, params->configFilePath, line_num); - REC_SignalError(errBuf, alarmAlready); } } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/lib/records/I_RecCore.h ---------------------------------------------------------------------- diff --git a/lib/records/I_RecCore.h b/lib/records/I_RecCore.h index 8b204c1..73bc157 100644 --- a/lib/records/I_RecCore.h +++ b/lib/records/I_RecCore.h @@ -177,8 +177,18 @@ int RecGetRecordPrefix_Xmalloc(char *prefix, char **result, int *result_len); //------------------------------------------------------------------------ // Signal and Alarms //------------------------------------------------------------------------ -void RecSignalManager(int, const char *); +// RecSignalManager always sends a management signal up to traffic_manager. +void RecSignalManager(int id, const char * , size_t); + +static inline void +RecSignalManager(int id, const char * str) { + RecSignalManager(id, str, strlen(str + 1)); +} + +// Format a message, and send it to the manager and to the Warning diagnostic. +void RecSignalWarning(int sig, const char * fmt, ...) + TS_PRINTFLIKE(2, 3); //------------------------------------------------------------------------- // Backwards Compatibility Items (REC_ prefix) @@ -280,20 +290,6 @@ int RecResetStatRecord(RecT type = RECT_NULL, bool all = false); //------------------------------------------------------------------------ int RecSetSyncRequired(char *name, bool lock = true); - -//------------------------------------------------------------------------ -// Signal Alarm/Warning/Error -//------------------------------------------------------------------------ -#define REC_SignalManager RecSignalManager -#define REC_SignalWarning(_n,_d) { Warning("%s", _d); RecSignalManager(_n,_d); } -#define REC_SignalError(_buf, _already) { \ - if(_already == false) \ - REC_SignalManager(REC_SIGNAL_CONFIG_ERROR, _buf); \ - _already = true; \ - Warning("%s", _buf); \ -} - - //------------------------------------------------------------------------ // Manager Callback //------------------------------------------------------------------------ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/lib/records/Makefile.am ---------------------------------------------------------------------- diff --git a/lib/records/Makefile.am b/lib/records/Makefile.am index 8c9323b..c291ac2 100644 --- a/lib/records/Makefile.am +++ b/lib/records/Makefile.am @@ -30,7 +30,6 @@ AM_CPPFLAGS = \ noinst_LIBRARIES = libreclocal.a librecprocess.a librec4cop.a -libreclocal_a_CXXFLAGS = $(ink_with_modules_local) libreclocal_a_SOURCES = \ I_RecAlarms.h \ I_RecCore.h \ @@ -60,7 +59,6 @@ libreclocal_a_SOURCES = \ RecDebug.cc \ RecConfigParse.cc -librecprocess_a_CXXFLAGS = $(ink_with_modules_process) librecprocess_a_SOURCES = \ I_RecAlarms.h \ I_RecCore.h \ @@ -90,8 +88,6 @@ librecprocess_a_SOURCES = \ RecDebug.cc \ RecConfigParse.cc - -librec4cop_a_CXXFLAGS = $(ink_with_modules_process) librec4cop_a_SOURCES = \ RecConfigParse.cc \ RecFile.cc \ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/lib/records/P_RecMessage.h ---------------------------------------------------------------------- diff --git a/lib/records/P_RecMessage.h b/lib/records/P_RecMessage.h index be7dcc6..1e68cb5 100644 --- a/lib/records/P_RecMessage.h +++ b/lib/records/P_RecMessage.h @@ -31,6 +31,7 @@ //------------------------------------------------------------------------- int RecMessageInit(); +void RecMessageRegister(); //------------------------------------------------------------------------- // Message Operations http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/lib/records/RecCore.cc ---------------------------------------------------------------------- diff --git a/lib/records/RecCore.cc b/lib/records/RecCore.cc index 176f8b3..dde2db7 100644 --- a/lib/records/RecCore.cc +++ b/lib/records/RecCore.cc @@ -77,7 +77,7 @@ register_record(RecT rec_type, const char *name, RecDataT data_type, RecData dat // link_XXX //------------------------------------------------------------------------- static int -link_int(const char *name, RecDataT data_type, RecData data, void *cookie) +link_int(const char * /* name */, RecDataT /* data_type */, RecData data, void *cookie) { RecInt *rec_int = (RecInt *) cookie; ink_atomic_swap(rec_int, data.rec_int); @@ -85,28 +85,28 @@ link_int(const char *name, RecDataT data_type, RecData data, void *cookie) } static int -link_int32(const char *name, RecDataT data_type, RecData data, void *cookie) +link_int32(const char * /* name */, RecDataT /* data_type */, RecData data, void *cookie) { *((int32_t *) cookie) = (int32_t) data.rec_int; return REC_ERR_OKAY; } static int -link_uint32(const char *name, RecDataT data_type, RecData data, void *cookie) +link_uint32(const char * /* name */, RecDataT /* data_type */, RecData data, void *cookie) { *((uint32_t *) cookie) = (uint32_t) data.rec_int; return REC_ERR_OKAY; } static int -link_float(const char *name, RecDataT data_type, RecData data, void *cookie) +link_float(const char * /* name */, RecDataT /* data_type */, RecData data, void *cookie) { *((RecFloat *) cookie) = data.rec_float; return REC_ERR_OKAY; } static int -link_counter(const char *name, RecDataT data_type, RecData data, void *cookie) +link_counter(const char * /* name */, RecDataT /* data_type */, RecData data, void *cookie) { RecCounter *rec_counter = (RecCounter *) cookie; ink_atomic_swap(rec_counter, data.rec_counter); @@ -116,7 +116,7 @@ link_counter(const char *name, RecDataT data_type, RecData data, void *cookie) // This is a convenience wrapper, to allow us to treat the RecInt's as a // 1-byte entity internally. static int -link_byte(const char *name, RecDataT data_type, RecData data, void *cookie) +link_byte(const char * /* name */, RecDataT /* data_type */, RecData data, void *cookie) { RecByte *rec_byte = (RecByte *) cookie; RecByte byte = static_cast<RecByte>(data.rec_int); @@ -129,7 +129,7 @@ link_byte(const char *name, RecDataT data_type, RecData data, void *cookie) // cookie e.g. is the DEFAULT_xxx_str value which this functiion keeps up to date with // the latest default applied during a config update from records.config static int -link_string_alloc(const char *name, RecDataT data_type, RecData data, void *cookie) +link_string_alloc(const char * /* name */, RecDataT /* data_type */, RecData data, void *cookie) { RecString _ss = data.rec_string; RecString _new_value = NULL; @@ -622,13 +622,16 @@ RecGetRecordCheckExpr(const char *name, char **check_expr, bool lock) return err; } - int RecGetRecordDefaultDataString_Xmalloc(char *name, char **buf, bool lock) { int err; RecRecord *r = NULL; + if (lock) { + ink_rwlock_rdlock(&g_records_rwlock); + } + if (ink_hash_table_lookup(g_records_ht, name, (void **) &r)) { *buf = (char *)ats_malloc(sizeof(char) * 1024); memset(*buf, 0, 1024); @@ -662,6 +665,10 @@ RecGetRecordDefaultDataString_Xmalloc(char *name, char **buf, bool lock) err = REC_ERR_FAIL; } + if (lock) { + ink_rwlock_unlock(&g_records_rwlock); + } + return err; } @@ -870,7 +877,7 @@ RecForceInsert(RecRecord * record) //------------------------------------------------------------------------- static void -debug_record_callback(RecT rec_type, void *edata, int registered, const char *name, int data_type, RecData *datum) +debug_record_callback(RecT /* rec_type */, void * /* edata */, int registered, const char *name, int data_type, RecData *datum) { switch(data_type) { case RECD_INT: @@ -1183,39 +1190,18 @@ RecConfigReadPersistentStatsPath() return Layout::relative_to(rundir, REC_RAW_STATS_FILE); } -//------------------------------------------------------------------------- -// REC_SignalManager (TS) -//------------------------------------------------------------------------- -#if defined(LOCAL_MANAGER) - -#include "LocalManager.h" - void -RecSignalManager(int /* id ATS_UNUSED */, const char */* msg ATS_UNUSED */) +RecSignalWarning(int sig, const char * fmt, ...) { -} + char msg[1024]; + va_list args; -int -RecRegisterManagerCb(int _signal, RecManagerCb _fn, void *_data) -{ - return lmgmt->registerMgmtCallback(_signal, _fn, _data); -} + va_start(args, fmt); + WarningV(fmt, args); + va_end(args); -#elif defined(PROCESS_MANAGER) - -#include "ProcessManager.h" - -void -RecSignalManager(int id, const char *msg) -{ - ink_assert(pmgmt); - pmgmt->signalManager(id, msg); -} - -int -RecRegisterManagerCb(int _signal, RecManagerCb _fn, void *_data) -{ - return pmgmt->registerMgmtCallback(_signal, _fn, _data); + va_start(args, fmt); + vsnprintf(msg, sizeof(msg), fmt, args); + RecSignalManager(sig, msg); + va_end(args); } - -#endif // LOCAL_MANAGER http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/lib/records/RecLocal.cc ---------------------------------------------------------------------- diff --git a/lib/records/RecLocal.cc b/lib/records/RecLocal.cc index 25ed956..9dab6b1 100644 --- a/lib/records/RecLocal.cc +++ b/lib/records/RecLocal.cc @@ -29,6 +29,7 @@ #include "P_RecMessage.h" #include "P_RecUtils.h" #include "P_RecFile.h" +#include "LocalManager.h" static bool g_initialized = false; static bool g_message_initialized = false; @@ -66,7 +67,7 @@ i_am_the_record_owner(RecT rec_type) // sync_thr //------------------------------------------------------------------------- static void * -sync_thr(void *data) +sync_thr(void * /* data */) { textBuffer *tb = new textBuffer(65536); Rollback *rb; @@ -108,7 +109,7 @@ sync_thr(void *data) // config_update_thr //------------------------------------------------------------------------- static void * -config_update_thr(void *data) +config_update_thr(void * /* data */) { while (true) { RecExecConfigUpdateCbs(REC_LOCAL_UPDATE_REQUIRED); @@ -183,3 +184,46 @@ RecLocalStart() return REC_ERR_OKAY; } + +int +RecRegisterManagerCb(int id, RecManagerCb _fn, void *_data) +{ + return lmgmt->registerMgmtCallback(id, _fn, _data); +} + +void +RecSignalManager(int id, const char *, size_t) +{ + // Signals are messages sent across the management pipe, so by definition, + // you can't send a signal if you are a local process manager. + RecDebug(DL_Debug, "local manager dropping signal %d", id); +} + +void +RecMessageRegister() +{ + lmgmt->registerMgmtCallback(MGMT_SIGNAL_LIBRECORDS, RecMessageRecvThis, NULL); +} + +//------------------------------------------------------------------------- +// RecMessageSend +//------------------------------------------------------------------------- + +int +RecMessageSend(RecMessage * msg) +{ + int msg_size; + + if (!g_message_initialized) + return REC_ERR_OKAY; + + // Make a copy of the record, but truncate it to the size actually used + if (g_mode_type == RECM_CLIENT || g_mode_type == RECM_SERVER) { + msg->o_end = msg->o_write; + msg_size = sizeof(RecMessageHdr) + (msg->o_write - msg->o_start); + lmgmt->signalEvent(MGMT_EVENT_LIBRECORDS, (char *) msg, msg_size); + } + + return REC_ERR_OKAY; +} + http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/lib/records/RecMessage.cc ---------------------------------------------------------------------- diff --git a/lib/records/RecMessage.cc b/lib/records/RecMessage.cc index ee864d8..a5ac467 100644 --- a/lib/records/RecMessage.cc +++ b/lib/records/RecMessage.cc @@ -35,19 +35,6 @@ static RecMessageRecvCb g_recv_cb = NULL; static void *g_recv_cookie = NULL; //------------------------------------------------------------------------- -// -// REC_BUILD_MGMT IMPLEMENTATION -// -//------------------------------------------------------------------------- -#if defined(LOCAL_MANAGER) -#include "LocalManager.h" -#elif defined(PROCESS_MANAGER) -#include "ProcessManager.h" -#else -#error "Required #define not specificed; expected LOCAL_MANAGER or PROCESS_MANAGER" -#endif - -//------------------------------------------------------------------------- // RecMessageInit //------------------------------------------------------------------------- @@ -64,44 +51,13 @@ RecMessageInit() */ ink_assert(g_mode_type != RECM_NULL); -#if defined (LOCAL_MANAGER) - lmgmt->registerMgmtCallback(MGMT_SIGNAL_LIBRECORDS, RecMessageRecvThis, NULL); -#elif defined(PROCESS_MANAGER) - pmgmt->registerMgmtCallback(MGMT_EVENT_LIBRECORDS, RecMessageRecvThis, NULL); -#endif + RecMessageRegister(); g_message_initialized = true; return REC_ERR_OKAY; } //------------------------------------------------------------------------- -// RecMessageSend -//------------------------------------------------------------------------- - -int -RecMessageSend(RecMessage * msg) -{ - int msg_size; - - if (!g_message_initialized) - return REC_ERR_OKAY; - - // Make a copy of the record, but truncate it to the size actually used - if (g_mode_type == RECM_CLIENT || g_mode_type == RECM_SERVER) { - msg->o_end = msg->o_write; - msg_size = sizeof(RecMessageHdr) + (msg->o_write - msg->o_start); -#if defined (LOCAL_MANAGER) - lmgmt->signalEvent(MGMT_EVENT_LIBRECORDS, (char *) msg, msg_size); -#elif defined(PROCESS_MANAGER) - pmgmt->signalManager(MGMT_SIGNAL_LIBRECORDS, (char *) msg, msg_size); -#endif - } - - return REC_ERR_OKAY; -} - - -//------------------------------------------------------------------------- // RecMessageAlloc //------------------------------------------------------------------------- RecMessage * @@ -310,7 +266,7 @@ RecMessageRegisterRecvCb(RecMessageRecvCb recv_cb, void *cookie) //------------------------------------------------------------------------- void * -RecMessageRecvThis(void *cookie, char *data_raw, int data_len) +RecMessageRecvThis(void * /* cookie */, char *data_raw, int /* data_len */) { RecMessage *msg = (RecMessage *) data_raw; g_recv_cb(msg, msg->msg_type, g_recv_cookie); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/lib/records/RecProcess.cc ---------------------------------------------------------------------- diff --git a/lib/records/RecProcess.cc b/lib/records/RecProcess.cc index 0a38cb8..079cea2 100644 --- a/lib/records/RecProcess.cc +++ b/lib/records/RecProcess.cc @@ -33,6 +33,7 @@ #include "P_RecFile.h" #include "mgmtapi.h" +#include "ProcessManager.h" static bool g_initialized = false; static bool g_message_initialized = false; @@ -334,7 +335,7 @@ struct raw_stat_sync_cont: public Continuation SET_HANDLER(&raw_stat_sync_cont::exec_callbacks); } - int exec_callbacks(int event, Event *e) + int exec_callbacks(int /* event */, Event * /* e */) { RecExecRawStatSyncCbs(); Debug("statsproc", "raw_stat_sync_cont() processed"); @@ -355,7 +356,7 @@ struct config_update_cont: public Continuation SET_HANDLER(&config_update_cont::exec_callbacks); } - int exec_callbacks(int event, Event *e) + int exec_callbacks(int /* event */, Event * /* e */) { RecExecConfigUpdateCbs(REC_PROCESS_UPDATE_REQUIRED); Debug("statsproc", "config_update_cont() processed"); @@ -387,7 +388,7 @@ struct sync_cont: public Continuation } } - int sync(int event, Event *e) + int sync(int /* event */, Event * /* e */) { send_push_message(); RecSyncStatsFile(); @@ -887,3 +888,45 @@ RecExecRawStatSyncCbs() return REC_ERR_OKAY; } + +void +RecSignalManager(int id, const char * msg, size_t msgsize) +{ + ink_assert(pmgmt); + pmgmt->signalManager(id, msg, msgsize); +} + +int +RecRegisterManagerCb(int _signal, RecManagerCb _fn, void *_data) +{ + return pmgmt->registerMgmtCallback(_signal, _fn, _data); +} + +void +RecMessageRegister() +{ + pmgmt->registerMgmtCallback(MGMT_EVENT_LIBRECORDS, RecMessageRecvThis, NULL); +} + +//------------------------------------------------------------------------- +// RecMessageSend +//------------------------------------------------------------------------- + +int +RecMessageSend(RecMessage * msg) +{ + int msg_size; + + if (!g_message_initialized) + return REC_ERR_OKAY; + + // Make a copy of the record, but truncate it to the size actually used + if (g_mode_type == RECM_CLIENT || g_mode_type == RECM_SERVER) { + msg->o_end = msg->o_write; + msg_size = sizeof(RecMessageHdr) + (msg->o_write - msg->o_start); + pmgmt->signalManager(MGMT_SIGNAL_LIBRECORDS, (char *) msg, msg_size); + } + + return REC_ERR_OKAY; +} + http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/mgmt/Alarms.h ---------------------------------------------------------------------- diff --git a/mgmt/Alarms.h b/mgmt/Alarms.h index 568d582..f3fc546 100644 --- a/mgmt/Alarms.h +++ b/mgmt/Alarms.h @@ -44,7 +44,7 @@ /*********************************************************************** * - * MODULAIZATTION: if you are adding new alarms, please ensure to add + * MODULARIZATTION: if you are adding new alarms, please ensure to add * the corresponding alarms in librecords/I_RecAlarms.h * * http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/mgmt/BaseManager.h ---------------------------------------------------------------------- diff --git a/mgmt/BaseManager.h b/mgmt/BaseManager.h index 0fa7a3c..d0a7614 100644 --- a/mgmt/BaseManager.h +++ b/mgmt/BaseManager.h @@ -99,7 +99,7 @@ #define MGMT_SIGNAL_HTTP_CONGESTED_SERVER 20 /* Congestion control -- congested server */ #define MGMT_SIGNAL_HTTP_ALLEVIATED_SERVER 21 /* Congestion control -- alleviated server */ -#define INK_MGMT_SIGNAL_SAC_SERVER_DOWN 400 +#define MGMT_SIGNAL_SAC_SERVER_DOWN 400 typedef struct _mgmt_message_hdr_type { http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/mgmt/LocalManager.cc ---------------------------------------------------------------------- diff --git a/mgmt/LocalManager.cc b/mgmt/LocalManager.cc index 3ffb141..169396d 100644 --- a/mgmt/LocalManager.cc +++ b/mgmt/LocalManager.cc @@ -650,7 +650,7 @@ LocalManager::handleMgmtMsgFromProcesses(MgmtMessageHdr * mh) alarm_keeper->signalAlarm(MGMT_ALARM_PROXY_HTTP_ALLEVIATED_SERVER, data_raw); break; // Congestion Control - end - case INK_MGMT_SIGNAL_SAC_SERVER_DOWN: + case MGMT_SIGNAL_SAC_SERVER_DOWN: alarm_keeper->signalAlarm(MGMT_ALARM_SAC_SERVER_DOWN, data_raw); break; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/mgmt/Main.cc ---------------------------------------------------------------------- diff --git a/mgmt/Main.cc b/mgmt/Main.cc index 12bfe39..5f285c5 100644 --- a/mgmt/Main.cc +++ b/mgmt/Main.cc @@ -70,8 +70,6 @@ FileManager *configFiles; StatProcessor *statProcessor; // Statistics Processors AppVersionInfo appVersionInfo; // Build info for this application -int diags_init = 0; - static inkcoreapi DiagsConfig *diagsConfig; static char debug_tags[1024] = ""; static char action_tags[1024] = ""; @@ -585,7 +583,6 @@ main(int argc, char **argv) if (is_debug_tag_set("diags")) diags->dump(); diags->cleanup_func = mgmt_cleanup; - diags_init = 1; // Setup the exported manager version records. RecSetRecordString("proxy.node.version.manager.short", appVersionInfo.VersionStr); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/mgmt/ProcessManager.cc ---------------------------------------------------------------------- diff --git a/mgmt/ProcessManager.cc b/mgmt/ProcessManager.cc index 1a9e292..4030e41 100644 --- a/mgmt/ProcessManager.cc +++ b/mgmt/ProcessManager.cc @@ -26,7 +26,6 @@ #undef HTTP_CACHE #include "InkAPIInternal.h" #include "MgmtUtils.h" -#define _PROCESS_MANAGER #include "ProcessManager.h" #include "ink_apidefs.h" http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/mgmt/ProcessManager.h ---------------------------------------------------------------------- diff --git a/mgmt/ProcessManager.h b/mgmt/ProcessManager.h index 9696b6d..8afbbdd 100644 --- a/mgmt/ProcessManager.h +++ b/mgmt/ProcessManager.h @@ -101,9 +101,6 @@ private: ConfigUpdateCbTable * cbtable; }; /* End class ProcessManager */ -#ifndef _PROCESS_MANAGER -#define _PROCESS_MANAGER inkcoreapi extern ProcessManager *pmgmt; -#endif /* _PROCESS_MANAGER */ #endif /* _PROCESS_MANAGER_H */ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/mgmt/api/CoreAPI.cc ---------------------------------------------------------------------- diff --git a/mgmt/api/CoreAPI.cc b/mgmt/api/CoreAPI.cc index a90f582..a27ed09 100644 --- a/mgmt/api/CoreAPI.cc +++ b/mgmt/api/CoreAPI.cc @@ -47,8 +47,6 @@ #include "EventCallback.h" #include "I_Layout.h" -extern int diags_init; // from Main.cc - // global variable CallbackTable *local_event_callbacks; @@ -131,7 +129,7 @@ Diags(TSDiagsT mode, const char *fmt, va_list ap) level = DL_Diag; } - if (diags_init) { // check that diags is initialized + if (diags) { // check that diags is initialized diags->print_va("TSMgmtAPI", level, NULL, fmt, ap); va_end(ap); } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/mgmt/api/TSControlMain.cc ---------------------------------------------------------------------- diff --git a/mgmt/api/TSControlMain.cc b/mgmt/api/TSControlMain.cc index 67fe691..71e7ad0 100644 --- a/mgmt/api/TSControlMain.cc +++ b/mgmt/api/TSControlMain.cc @@ -43,8 +43,6 @@ #define TIMEOUT_SECS 1; // the num secs for select timeout -extern int diags_init; // from Main.cc - InkHashTable *accepted_con; // a list of all accepted client connections /********************************************************************* @@ -970,7 +968,7 @@ handle_diags(struct SocketInfo /* sock_info ATS_UNUSED */, char *req) level = DL_Diag; //default value should be Diag not UNDEFINED } - if (diags_init) { + if (diags) { diags->print("TSMgmtAPI", DTA(level), "%s", diag_msg); ats_free(diag_msg); return TS_ERR_OKAY; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/mgmt/utils/Makefile.am ---------------------------------------------------------------------- diff --git a/mgmt/utils/Makefile.am b/mgmt/utils/Makefile.am index ca7db73..388217a 100644 --- a/mgmt/utils/Makefile.am +++ b/mgmt/utils/Makefile.am @@ -36,15 +36,16 @@ EXTRA_DIST = MgmtHashTable.h MgmtSocket.h noinst_LIBRARIES = libutils_lm.a libutils_p.a -libutils_lm_a_CPPFLAGS = $(ink_with_modules_local) $(AM_CPPFLAGS) libutils_lm_a_SOURCES = \ ExpandingArray.cc \ ExpandingArray.h \ + MgmtLocalCleanup.cc \ MgmtUtils.cc \ MgmtUtils.h \ WebMgmtUtils.cc \ WebMgmtUtils.h libutils_p_a_SOURCES = \ + MgmtProcessCleanup.cc \ MgmtUtils.cc \ MgmtUtils.h http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/mgmt/utils/MgmtLocalCleanup.cc ---------------------------------------------------------------------- diff --git a/mgmt/utils/MgmtLocalCleanup.cc b/mgmt/utils/MgmtLocalCleanup.cc new file mode 100644 index 0000000..be9c39c --- /dev/null +++ b/mgmt/utils/MgmtLocalCleanup.cc @@ -0,0 +1,33 @@ +/** @file + + Management cleanup for the local manager. + + @section license License + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#include "MgmtUtils.h" +#include "LocalManager.h" + +void +mgmt_cleanup() +{ + if (lmgmt != NULL) { + lmgmt->mgmtShutdown(true); + } +} http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/mgmt/utils/MgmtProcessCleanup.cc ---------------------------------------------------------------------- diff --git a/mgmt/utils/MgmtProcessCleanup.cc b/mgmt/utils/MgmtProcessCleanup.cc new file mode 100644 index 0000000..e46e2be --- /dev/null +++ b/mgmt/utils/MgmtProcessCleanup.cc @@ -0,0 +1,30 @@ +/** @file + + Management cleanup for the process manager. + + @section license License + + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +#include "MgmtUtils.h" + +void +mgmt_cleanup() +{ + // No cleanup to do with a process manager +} http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/mgmt/utils/MgmtUtils.cc ---------------------------------------------------------------------- diff --git a/mgmt/utils/MgmtUtils.cc b/mgmt/utils/MgmtUtils.cc index 61e70ed..e52e28a 100644 --- a/mgmt/utils/MgmtUtils.cc +++ b/mgmt/utils/MgmtUtils.cc @@ -24,19 +24,7 @@ #include "MgmtUtils.h" #include "Diags.h" -#ifdef LOCAL_MANAGER -// mgmt/Main.h #include "LocalManager.h" -//#include "../Main.h" -#else -// proxy/Main.h -#include "../../proxy/Main.h" -#endif - -#if defined(LOCAL_MANAGER) || defined(PROCESS_MANAGER) -// diags_init defined in mgmt/Main.cc. -extern int diags_init; -#endif static int use_syslog = 0; @@ -94,7 +82,6 @@ mgmt_readline(int soc, char *buf, int maxlen) return n; } /* End mgmt_readline */ - /* * mgmt_writeline(...) * Simple, inefficient, write line function. Takes a soc to write to, @@ -216,8 +203,6 @@ mgmt_write_pipe(int fd, char *buf, int bytes_to_write) return bytes_written; } - - void mgmt_blockAllSigs() { @@ -245,11 +230,9 @@ mgmt_log(FILE * log, const char *message_format, ...) va_start(ap, message_format); -#if defined(LOCAL_MANAGER) || defined(PROCESS_MANAGER) - if (diags_init) { + if (diags) { diags->print_va(NULL, DL_Note, NULL, message_format, ap); } else { -#endif if (use_syslog) { snprintf(extended_format, sizeof(extended_format), "log ==> %s", message_format); @@ -260,9 +243,7 @@ mgmt_log(FILE * log, const char *message_format, ...) vsprintf(message, extended_format, ap); ink_assert(fwrite(message, strlen(message), 1, log) == 1); } -#if defined(LOCAL_MANAGER) || defined(PROCESS_MANAGER) } -#endif va_end(ap); return; @@ -275,11 +256,9 @@ mgmt_log(const char *message_format, ...) char extended_format[4096], message[4096]; va_start(ap, message_format); -#if defined(LOCAL_MANAGER) || defined(PROCESS_MANAGER) - if (diags_init) { + if (diags) { diags->print_va(NULL, DL_Note, NULL, message_format, ap); } else { -#endif if (use_syslog) { snprintf(extended_format, sizeof(extended_format), "log ==> %s", message_format); @@ -290,15 +269,12 @@ mgmt_log(const char *message_format, ...) vsprintf(message, extended_format, ap); ink_assert(fwrite(message, strlen(message), 1, stderr) == 1); } -#if defined(LOCAL_MANAGER) || defined(PROCESS_MANAGER) } -#endif va_end(ap); return; } /* End mgmt_log */ - /* * mgmt_log(...) * Same as above, but intended for errors. @@ -311,14 +287,12 @@ mgmt_elog(FILE * log, const int lerrno, const char *message_format, ...) va_start(ap, message_format); -#if defined(LOCAL_MANAGER) || defined(PROCESS_MANAGER) - if (diags_init) { + if (diags) { diags->print_va(NULL, DL_Error, NULL, message_format, ap); if (lerrno != 0) { diags->print(NULL, DTA(DL_Error), " (last system error %d: %s)\n", lerrno, strerror(lerrno)); } } else { -#endif if (use_syslog) { snprintf(extended_format, sizeof(extended_format), "ERROR ==> %s", message_format); vsprintf(message, extended_format, ap); @@ -335,15 +309,12 @@ mgmt_elog(FILE * log, const int lerrno, const char *message_format, ...) ink_assert(fwrite(message, strlen(message), 1, log) == 1); } } -#if defined(LOCAL_MANAGER) || defined(PROCESS_MANAGER) } -#endif va_end(ap); return; } /* End mgmt_elog */ - void mgmt_elog(const int lerrno, const char *message_format, ...) { @@ -352,14 +323,12 @@ mgmt_elog(const int lerrno, const char *message_format, ...) va_start(ap, message_format); -#if defined(LOCAL_MANAGER) || defined(PROCESS_MANAGER) - if (diags_init) { + if (diags) { diags->print_va(NULL, DL_Error, NULL, message_format, ap); if (lerrno != 0) { diags->print(NULL, DTA(DL_Error), " (last system error %d: %s)\n", lerrno, strerror(lerrno)); } } else { -#endif if (use_syslog) { snprintf(extended_format, sizeof(extended_format), "ERROR ==> %s", message_format); @@ -377,14 +346,11 @@ mgmt_elog(const int lerrno, const char *message_format, ...) ink_assert(fwrite(message, strlen(message), 1, stderr) == 1); } } -#if defined(LOCAL_MANAGER) || defined(PROCESS_MANAGER) } -#endif va_end(ap); return; } /* End mgmt_elog */ - /* * mgmt_fatal(...) * Same as above, but for fatal errors. Logs error, calls perror, and @@ -398,15 +364,12 @@ mgmt_fatal(FILE * log, const int lerrno, const char *message_format, ...) va_start(ap, message_format); - -#if defined(LOCAL_MANAGER) || defined(PROCESS_MANAGER) - if (diags_init) { + if (diags) { diags->print_va(NULL, DL_Fatal, NULL, message_format, ap); if (lerrno != 0) { diags->print(NULL, DTA(DL_Fatal), " (last system error %d: %s)\n", lerrno, strerror(lerrno)); } } else { -#endif snprintf(extended_format, sizeof(extended_format), "FATAL ==> %s", message_format); vsprintf(message, extended_format, ap); @@ -424,9 +387,7 @@ mgmt_fatal(FILE * log, const int lerrno, const char *message_format, ...) } } -#if defined(LOCAL_MANAGER) || defined(PROCESS_MANAGER) } -#endif va_end(ap); @@ -434,8 +395,6 @@ mgmt_fatal(FILE * log, const int lerrno, const char *message_format, ...) _exit(1); } /* End mgmt_fatal */ - - void mgmt_fatal(const int lerrno, const char *message_format, ...) { @@ -444,14 +403,12 @@ mgmt_fatal(const int lerrno, const char *message_format, ...) va_start(ap, message_format); -#if defined(LOCAL_MANAGER) || defined(PROCESS_MANAGER) - if (diags_init) { + if (diags) { diags->print_va(NULL, DL_Fatal, NULL, message_format, ap); if (lerrno != 0) { diags->print(NULL, DTA(DL_Fatal), " (last system error %d: %s)\n", lerrno, strerror(lerrno)); } } else { -#endif snprintf(extended_format, sizeof(extended_format), "FATAL ==> %s", message_format); vsprintf(message, extended_format, ap); @@ -469,9 +426,7 @@ mgmt_fatal(const int lerrno, const char *message_format, ...) syslog(LOG_ERR, " (last system error %d: %s)", lerrno, strerror(lerrno)); } } -#if defined(LOCAL_MANAGER) || defined(PROCESS_MANAGER) } -#endif va_end(ap); @@ -479,16 +434,6 @@ mgmt_fatal(const int lerrno, const char *message_format, ...) _exit(1); } /* End mgmt_fatal */ -void -mgmt_cleanup() -{ -#if defined(LOCAL_MANAGER) - if (lmgmt != NULL) { - lmgmt->mgmtShutdown(true); - } -#endif -} - static inline int get_interface_mtu(int sock_fd, struct ifreq *ifr) { http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/proxy/ICP.cc ---------------------------------------------------------------------- diff --git a/proxy/ICP.cc b/proxy/ICP.cc index 6d1cb98..57e1929 100644 --- a/proxy/ICP.cc +++ b/proxy/ICP.cc @@ -691,8 +691,7 @@ ICPPeerReadCont::PeerReadStateMachine(PeerReadData * s, Event * e) return EVENT_CONT; } if (!_ICPpr->GetFreePeers() || !_ICPpr->GetFreeSendPeers()) { - Warning("ICP Peer limit exceeded"); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP Peer limit exceeded"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP Peer limit exceeded"); _ICPpr->GetConfig()->Unlock(); goto invalid_message; } @@ -1952,8 +1951,7 @@ ICPProcessor::BuildPeerList() if (!mgmt_getAddrForIntr(GetConfig()->globalConfig()->ICPinterface(), &tmp_ip.sa)) { Pcfg->_ip_addr._family = AF_UNSPEC; // No IP address for given interface - Warning("ICP interface [%s] has no IP address", GetConfig()->globalConfig()->ICPinterface()); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP interface has no IP address"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP interface [%s] has no IP address", GetConfig()->globalConfig()->ICPinterface()); } else { Pcfg->_my_ip_addr = Pcfg->_ip_addr = tmp_ip; } @@ -2088,22 +2086,19 @@ ICPProcessor::SetupListenSockets() // Perform some basic sanity checks on the ICP configuration. // if (!_LocalPeer) { - Warning("ICP setup, no defined local Peer"); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP setup, no defined local Peer"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP setup, no defined local Peer"); return 1; // Failed } if (GetSendPeers() == 0) { if (!allow_null_configuration) { - Warning("ICP setup, no defined send Peer(s)"); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP setup, no defined send Peer(s)"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP setup, no defined send Peer(s)"); return 1; // Failed } } if (GetRecvPeers() == 0) { if (!allow_null_configuration) { - Warning("ICP setup, no defined receive Peer(s)"); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP setup, no defined receive Peer(s)"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP setup, no defined receive Peer(s)"); return 1; // Failed } } @@ -2130,12 +2125,11 @@ ICPProcessor::SetupListenSockets() status = pMC->GetSendChan()->setup_mc_send(pMC->GetIP(), _LocalPeer->GetIP(), NON_BLOCKING, pMC->GetTTL(), DISABLE_MC_LOOPBACK, _mcastCB_handler); if (status) { // coverity[uninit_use_in_call] - Warning("ICP MC send setup failed, res=%d, ip=%s bind_ip=%s", + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP MC send setup failed, res=%d, ip=%s bind_ip=%s", status, ats_ip_nptop(pMC->GetIP(), ipb, sizeof(ipb)), ats_ip_nptop(_LocalPeer->GetIP(), ipb2, sizeof(ipb2)) ); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP MC send setup failed"); return 1; // Failed } @@ -2144,9 +2138,8 @@ ICPProcessor::SetupListenSockets() NON_BLOCKING, pMC->GetSendChan(), _mcastCB_handler); if (status) { // coverity[uninit_use_in_call] - Warning("ICP MC recv setup failed, res=%d, ip=%s", + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP MC recv setup failed, res=%d, ip=%s", status, ats_ip_nptop(pMC->GetIP(), ipb, sizeof(ipb))); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP MC recv setup failed"); return 1; // Failed } } @@ -2167,11 +2160,10 @@ ICPProcessor::SetupListenSockets() status = pPS->GetChan()->open(options); if (status) { // coverity[uninit_use_in_call] ? - Warning("ICP bind_connect failed, res=%d, ip=%s", + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP bind_connect failed, res=%d, ip=%s", status, ats_ip_nptop(pPS->GetIP(), ipb, sizeof(ipb)) ); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "ICP bind_connect for localhost failed"); return 1; // Failed } @@ -2384,8 +2376,7 @@ ICPProcessor::AddPeer(Peer * P) if (FindPeer(P->GetIP())) { ip_port_text_buffer x; // coverity[uninit_use_in_call] - Warning("bad icp.config, multiple peer definitions for ip=%s", ats_ip_nptop(P->GetIP(), x, sizeof(x))); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "bad icp.config, multiple peer definitions"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "bad icp.config, multiple peer definitions for ip=%s", ats_ip_nptop(P->GetIP(), x, sizeof(x))); return 0; // Not added } else { http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/proxy/ICPConfig.cc ---------------------------------------------------------------------- diff --git a/proxy/ICPConfig.cc b/proxy/ICPConfig.cc index 5b957b1..e799fc5 100644 --- a/proxy/ICPConfig.cc +++ b/proxy/ICPConfig.cc @@ -548,8 +548,7 @@ ICPConfiguration::icp_config_change_callback(void *data, void *value, int startu ats_scoped_str config_path(Layout::get()->relative_to(Layout::get()->sysconfdir, filename)); int fd = open(config_path, O_RDONLY); if (fd < 0) { - Warning("read icp.config, open failed"); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, open failed"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, open failed"); delete[]P; return EVENT_DONE; } @@ -592,8 +591,7 @@ ICPConfiguration::icp_config_change_callback(void *data, void *value, int startu continue; if (n >= MAX_DEFINED_PEERS) { - Warning("read icp.config, maximum peer entries exceeded"); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, maximum peer entries exceeded"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, maximum peer entries exceeded"); error = 1; break; } @@ -608,8 +606,7 @@ ICPConfiguration::icp_config_change_callback(void *data, void *value, int startu char* last = cur + len -1; // last character. if ('\n' == *last) --last; // back over trailing LF. if (NULL == strchr(" ;:|,", *last)) { - Warning("read icp.config, invalid separator [value %d]", *last); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, invalid separator"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, invalid separator [value %d]", *last); error = 1; break; } @@ -622,8 +619,7 @@ ICPConfiguration::icp_config_change_callback(void *data, void *value, int startu ++n_colons; } if (n_colons != colons_per_entry) { - Warning("read icp.config, invalid syntax, line %d: expected %d fields, found %d", ln, colons_per_entry, n_colons); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, invalid syntax: wrong number of fields"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, invalid syntax, line %d: expected %d fields, found %d", ln, colons_per_entry, n_colons); error = 1; break; } @@ -645,8 +641,7 @@ ICPConfiguration::icp_config_change_callback(void *data, void *value, int startu *next++ = 0; if (cur != (next - 1)) { if (0 != P[n]._ip_addr.load(cur)) { - Warning("read icp.config, bad host ip_addr, line %d", ln); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad host ip_addr"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad host ip_addr, line %d", ln); error = 1; break; } @@ -655,8 +650,7 @@ ICPConfiguration::icp_config_change_callback(void *data, void *value, int startu } if (!P[n]._hostname[0] && !P[n]._ip_addr.isValid()) { - Warning("read icp.config, bad hostname, line %d", ln); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad hostname"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad hostname, line %d", ln); error = 1; break; } @@ -669,14 +663,12 @@ ICPConfiguration::icp_config_change_callback(void *data, void *value, int startu if (cur != (next - 1)) { P[n]._ctype = atoi(cur); if ((P[n]._ctype != PeerConfigData::CTYPE_PARENT) && (P[n]._ctype != PeerConfigData::CTYPE_SIBLING)) { - Warning("read icp.config, bad ctype, line %d", ln); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad ctype"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad ctype, line %d", ln); error = 1; break; } } else { - Warning("read icp.config, 2bad ctype, line %d", ln); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, 2bad ctype"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, 2bad ctype, line %d", ln); error = 1; break; } @@ -688,14 +680,12 @@ ICPConfiguration::icp_config_change_callback(void *data, void *value, int startu *next++ = 0; if (cur != (next - 1)) { if ((P[n]._proxy_port = atoi(cur)) <= 0) { - Warning("read icp.config, bad proxy_port, line %d", ln); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad proxy_port"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad proxy_port, line %d", ln); error = 1; break; } } else { - Warning("read icp.config, 2bad proxy_port, line %d", ln); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, 2bad proxy_port"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, 2bad proxy_port, line %d", ln); error = 1; break; } @@ -707,14 +697,12 @@ ICPConfiguration::icp_config_change_callback(void *data, void *value, int startu *next++ = 0; if (cur != (next - 1)) { if ((P[n]._icp_port = atoi(cur)) <= 0) { - Warning("read icp.config, bad icp_port, line %d", ln); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad icp_port"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad icp_port, line %d", ln); error = 1; break; } } else { - Warning("read icp.config, 2bad icp_port, line %d", ln); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, 2bad icp_port"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, 2bad icp_port, line %d", ln); error = 1; break; } @@ -726,20 +714,17 @@ ICPConfiguration::icp_config_change_callback(void *data, void *value, int startu *next++ = 0; if (cur != (next - 1)) { if ((P[n]._mc_member = atoi(cur)) < 0) { - Warning("read icp.config, bad mc_member, line %d", ln); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad mc_member"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad mc_member, line %d", ln); error = 1; break; } if ((P[n]._mc_member != 0) && (P[n]._mc_member != 1)) { - Warning("read icp.config, bad mc_member (2), line %d", ln); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad mc_member (2)"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad mc_member (2), line %d", ln); error = 1; break; } } else { - Warning("read icp.config, 2bad mc_member, line %d", ln); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, 2bad mc_member"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, 2bad mc_member, line %d", ln); error = 1; break; } @@ -753,8 +738,7 @@ ICPConfiguration::icp_config_change_callback(void *data, void *value, int startu P[n]._mc_ip_addr.load(cur); // Validate only if "multicast_member" is set. if (P[n]._mc_member != 0 && !P[n]._mc_ip_addr.isMulticast()) { - Warning("read icp.config, bad multicast ip_addr, line %d", ln); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad multicast ip_addr"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad multicast ip_addr, line %d", ln); error = 1; break; } @@ -771,14 +755,12 @@ ICPConfiguration::icp_config_change_callback(void *data, void *value, int startu if (cur != (next - 1)) { P[n]._mc_ttl = atoi(cur); if ((P[n]._mc_ttl = atoi(cur)) <= 0) { - Warning("read icp.config, bad mc_ttl, line %d", ln); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad mc_ttl"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, bad mc_ttl, line %d", ln); error = 1; break; } } else { - Warning("read icp.config, 2bad mc_ttl, line %d", ln); - REC_SignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, 2bad mc_ttl"); + RecSignalWarning(REC_SIGNAL_CONFIG_ERROR, "read icp.config, 2bad mc_ttl, line %d", ln); error = 1; break; } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/proxy/congest/Congestion.cc ---------------------------------------------------------------------- diff --git a/proxy/congest/Congestion.cc b/proxy/congest/Congestion.cc index 974e843..7d7ae7a 100644 --- a/proxy/congest/Congestion.cc +++ b/proxy/congest/Congestion.cc @@ -733,5 +733,3 @@ CongestionEntry::go_alive() #define SERVER_CONGESTED_SIG REC_SIGNAL_HTTP_CONGESTED_SERVER #define SERVER_ALLEVIATED_SIG REC_SIGNAL_HTTP_ALLEVIATED_SERVER -#define CC_SignalWarning(sig, msg) \ - REC_SignalWarning(sig, msg) http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/proxy/logging/LogCollationClientSM.cc ---------------------------------------------------------------------- diff --git a/proxy/logging/LogCollationClientSM.cc b/proxy/logging/LogCollationClientSM.cc index 4d2264b..f836200 100644 --- a/proxy/logging/LogCollationClientSM.cc +++ b/proxy/logging/LogCollationClientSM.cc @@ -412,7 +412,7 @@ LogCollationClientSM::client_fail(int event, void * /* data ATS_UNUSED */) snprintf(msg_buf, sizeof(msg_buf), "Collation host %s:%u down", m_log_host->ip_addr().toString(ipb, sizeof ipb), m_log_host->m_port ); - REC_SignalManager(400, msg_buf); + RecSignalManager(MGMT_SIGNAL_SAC_SERVER_DOWN, msg_buf); m_host_is_up = false; } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/proxy/logging/LogStandalone.cc ---------------------------------------------------------------------- diff --git a/proxy/logging/LogStandalone.cc b/proxy/logging/LogStandalone.cc index 879a640..c4f5122 100644 --- a/proxy/logging/LogStandalone.cc +++ b/proxy/logging/LogStandalone.cc @@ -50,7 +50,6 @@ class HttpBodyFactory; extern int fds_limit; extern int cluster_port_number; -int diags_init = 0; int command_flag = 0; int http_accept_port_number = 0; int http_accept_file_descriptor = 0; @@ -218,7 +217,6 @@ init_log_standalone(const char *pgm_name, bool one_copy) initialize_process_manager(); diagsConfig = new DiagsConfig(logfile, error_tags, action_tags); diags = diagsConfig->diags; - diags_init = 1; } /*------------------------------------------------------------------------- @@ -252,5 +250,4 @@ init_log_standalone_basic(const char *pgm_name) setbuf(stdin, NULL); setbuf(stdout, NULL); - diags_init = 1; } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a2584bf2/proxy/logging/LogUtils.cc ---------------------------------------------------------------------- diff --git a/proxy/logging/LogUtils.cc b/proxy/logging/LogUtils.cc index 8d42258..dd8060b 100644 --- a/proxy/logging/LogUtils.cc +++ b/proxy/logging/LogUtils.cc @@ -40,7 +40,6 @@ #include <netdb.h> #include "P_RecProcess.h" -#define LOG_SignalManager REC_SignalManager // REC_SIGNAL_LOGGING_ERROR is defined in I_RecSignals.h // REC_SIGNAL_LOGGING_WARNING is defined in I_RecSignals.h @@ -227,11 +226,11 @@ LogUtils::manager_alarm(LogUtils::AlarmType alarm_type, const char *msg, ...) switch (alarm_type) { case LogUtils::LOG_ALARM_ERROR: - LOG_SignalManager(REC_SIGNAL_LOGGING_ERROR, msg_buf); + RecSignalManager(REC_SIGNAL_LOGGING_ERROR, msg_buf); break; case LogUtils::LOG_ALARM_WARNING: - LOG_SignalManager(REC_SIGNAL_LOGGING_WARNING, msg_buf); + RecSignalManager(REC_SIGNAL_LOGGING_WARNING, msg_buf); break; default:
