You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by am...@apache.org on 2015/07/19 16:14:45 UTC
[5/8] trafficserver git commit: TS-974: Partial Object Caching.
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/CfgContextImpl.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CfgContextImpl.cc b/mgmt/api/CfgContextImpl.cc
index 9a5f0e3..595fb9a 100644
--- a/mgmt/api/CfgContextImpl.cc
+++ b/mgmt/api/CfgContextImpl.cc
@@ -21,7 +21,6 @@
limitations under the License.
*/
-
#include "libts.h"
#include "ink_platform.h"
@@ -67,7 +66,6 @@ CommentObj::getCfgEleCopy()
return (TSCfgEle *)copy_comment_ele(m_ele);
}
-
//--------------------------------------------------------------------------
// CacheObj
//--------------------------------------------------------------------------
@@ -247,7 +245,6 @@ CacheObj::getCfgEleCopy()
return (TSCfgEle *)copy_cache_ele(m_ele);
}
-
//--------------------------------------------------------------------------
// CongestionObj
//--------------------------------------------------------------------------
@@ -465,7 +462,6 @@ CongestionObj::getCfgEleCopy()
return (TSCfgEle *)copy_congestion_ele(m_ele);
}
-
//--------------------------------------------------------------------------
// HostingObj
//--------------------------------------------------------------------------
@@ -976,7 +972,6 @@ IpAllowObj::getCfgEleCopy()
return (TSCfgEle *)copy_ip_allow_ele(m_ele);
}
-
//--------------------------------------------------------------------------
// ParentProxyObj
//--------------------------------------------------------------------------
@@ -1418,7 +1413,6 @@ PluginObj::getCfgEleCopy()
return (TSCfgEle *)copy_plugin_ele(m_ele);
}
-
//--------------------------------------------------------------------------
// RemapObj
//--------------------------------------------------------------------------
@@ -1449,7 +1443,8 @@ RemapObj::RemapObj(TokenList *tokens)
if (m_ele->cfg_ele.type == TS_TYPE_UNDEFINED) {
goto FORMAT_ERR;
}
- // The first token must either be "map, "reverse_map", "redirect", and redirect_temporary
+ // The first token must either be "map, "reverse_map", "redirect", and
+ // redirect_temporary
token = tokens->first();
// target
@@ -1460,7 +1455,8 @@ RemapObj::RemapObj(TokenList *tokens)
}
// TODO: Should we check the return value (count) here?
- fromTok.Initialize(token->name, ALLOW_EMPTY_TOKS); // allow empty token for parse sanity check
+ fromTok.Initialize(token->name, ALLOW_EMPTY_TOKS); // allow empty token for
+ // parse sanity check
if (strcmp(fromTok[0], "http") == 0) {
m_ele->from_scheme = TS_SCHEME_HTTP;
@@ -1514,7 +1510,8 @@ RemapObj::RemapObj(TokenList *tokens)
}
// TODO: Should we check the return value (count) here?
- toTok.Initialize(token->value, ALLOW_EMPTY_TOKS); // allow empty token for parse sanity check
+ toTok.Initialize(token->value, ALLOW_EMPTY_TOKS); // allow empty token for
+ // parse sanity check
if (strcmp(toTok[0], "http") == 0) {
m_ele->to_scheme = TS_SCHEME_HTTP;
@@ -2196,7 +2193,8 @@ StorageObj::StorageObj(TSStorageEle *ele)
m_valid = isValid(); // now validate
}
-// must have at least 1 token (token-name = pathname, token-value = size (if any) )
+// must have at least 1 token (token-name = pathname, token-value = size (if
+// any) )
StorageObj::StorageObj(TokenList *tokens)
{
Token *tok;
@@ -2389,7 +2387,6 @@ VirtIpAddrObj::getCfgEleCopy()
return (TSCfgEle *)copy_virt_ip_addr_ele(m_ele);
}
-
/*****************************************************************
* CfgContext
*****************************************************************/
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/CfgContextManager.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CfgContextManager.cc b/mgmt/api/CfgContextManager.cc
index d8a7196..83f4ab5 100644
--- a/mgmt/api/CfgContextManager.cc
+++ b/mgmt/api/CfgContextManager.cc
@@ -141,7 +141,6 @@ CfgContextCommit(CfgContext *ctx, LLQ *errRules)
return err;
}
-
/* ---------------------------------------------------------------
* CfgContextGet
* ---------------------------------------------------------------
@@ -198,7 +197,6 @@ CfgContextGet(CfgContext *ctx)
return TS_ERR_OKAY;
}
-
/***************************************************************
* CfgContext Operations
***************************************************************/
@@ -265,7 +263,6 @@ CfgContextGetObjAt(CfgContext *ctx, int index)
return NULL; // invalid index
}
-
/*--------------------------------------------------------------
* CfgContextGetEleAt
*--------------------------------------------------------------
@@ -304,7 +301,6 @@ CfgContextGetEleAt(CfgContext *ctx, int index)
return NULL; // invalid index
}
-
/*--------------------------------------------------------------
* CfgContextGetFirst
*--------------------------------------------------------------
@@ -375,7 +371,6 @@ CfgContextGetNext(CfgContext *ctx, TSCfgIterState *state)
return NULL; // ERROR
}
-
/*--------------------------------------------------------------
* CfgContextMoveEleUp
*--------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/CfgContextManager.h
----------------------------------------------------------------------
diff --git a/mgmt/api/CfgContextManager.h b/mgmt/api/CfgContextManager.h
index bce6fe8..8578af7 100644
--- a/mgmt/api/CfgContextManager.h
+++ b/mgmt/api/CfgContextManager.h
@@ -39,7 +39,6 @@
#include "CfgContextImpl.h"
#include "CfgContextDefs.h"
-
/***************************************************************************
* CfgContext Operations
***************************************************************************/
@@ -52,7 +51,6 @@ TSMgmtError CfgContextDestroy(CfgContext *ctx);
TSMgmtError CfgContextCommit(CfgContext *ctx, LLQ *errRules = NULL);
TSMgmtError CfgContextGet(CfgContext *ctx);
-
/***************************************************************************
* CfgContext Operations
***************************************************************************/
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/CfgContextUtils.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CfgContextUtils.cc b/mgmt/api/CfgContextUtils.cc
index 873a6eb..2452c51 100644
--- a/mgmt/api/CfgContextUtils.cc
+++ b/mgmt/api/CfgContextUtils.cc
@@ -86,7 +86,8 @@ string_to_ip_addr_ele(const char *str)
ip_a = ats_strdup(const_ip_a);
ip_b = ats_strdup(const_ip_b);
- // determine if ip's are cidr type; only test if ip_a is cidr, assume both are same
+ // determine if ip's are cidr type; only test if ip_a is cidr, assume both
+ // are same
cidr_tokens.Initialize(ip_a, COPY_TOKS);
numTokens = cidr_tokens.count();
if (numTokens == 1) { // Range, NON-CIDR TYPE
@@ -117,7 +118,6 @@ Lerror:
return NULL;
}
-
/* ----------------------------------------------------------------------------
* ip_addr_ele_to_string
* ---------------------------------------------------------------------------
@@ -208,7 +208,8 @@ ip_addr_to_string(TSIpAddr ip)
* string_to_ip_addr
* ---------------------------------------------------------------------------
* Converts an ip address in dotted-decimal string format into a string;
- * allocates memory for string. If IP is invalid, then returns TS_INVALID_IP_ADDR.
+ * allocates memory for string. If IP is invalid, then returns
+ * TS_INVALID_IP_ADDR.
*/
TSIpAddr
string_to_ip_addr(const char *str)
@@ -559,7 +560,6 @@ int_list_to_string(TSIntList list, const char *delimiter)
if (list == TS_INVALID_LIST || !delimiter)
return NULL;
-
numElems = queue_len((LLQ *)list);
memset(buf, 0, MAX_BUF_SIZE);
@@ -616,7 +616,6 @@ Lerror:
return TS_INVALID_LIST;
}
-
/* ---------------------------------------------------------------
* string_to_domain_list
* ---------------------------------------------------------------
@@ -654,7 +653,6 @@ string_to_domain_list(const char *str_list, const char *delimiter)
return list;
}
-
/*----------------------------------------------------------------------------
* domain_list_to_string
*----------------------------------------------------------------------------
@@ -958,7 +956,6 @@ pdest_sspec_to_string(TSPrimeDestT pd, char *pd_val, TSSspec *sspec)
return str;
}
-
/*----------------------------------------------------------------------------
* string_to_pdss_format
*----------------------------------------------------------------------------
@@ -1037,7 +1034,6 @@ Lerror:
return TS_ERR_FAIL;
}
-
/*----------------------------------------------------------------------------
* hms_time_to_string
*----------------------------------------------------------------------------
@@ -1185,7 +1181,6 @@ Lerror:
return TS_ERR_FAIL;
}
-
/*----------------------------------------------------------------------------
* string_to_header_type
*----------------------------------------------------------------------------
@@ -1247,7 +1242,6 @@ string_to_scheme_type(const char *scheme)
return TS_SCHEME_UNDEFINED;
}
-
char *
scheme_type_to_string(TSSchemeT scheme)
{
@@ -1486,7 +1480,6 @@ admin_acc_type_to_string(TSAccessT access)
return NULL;
}
-
/***************************************************************************
* Tokens-to-Struct Converstion Functions
***************************************************************************/
@@ -1531,7 +1524,6 @@ tokens_to_pdss_format(TokenList *tokens, Token *first_tok, TSPdSsFormat *pdss)
}
pdss->pd_val = ats_strdup(first_tok->value);
-
// iterate through tokens checking for sec specifiers
// state determines which sec specifier being checked
// the state is only set if there's a sec spec match
@@ -2104,7 +2096,6 @@ get_rule_type(TokenList *token_list, TSFileNameT file)
case TS_FNAME_IP_ALLOW: /* ip_allow.config */
return TS_IP_ALLOW;
-
case TS_FNAME_LOGS_XML: /* logs_xml.config */
printf(" *** CfgContextUtils.cc: NOT DONE YET! **\n");
// TS_LOG_FILTER, /* logs_xml.config */
@@ -2187,7 +2178,6 @@ copy_cfg_ele(TSCfgEle *src_ele, TSCfgEle *dst_ele)
dst_ele->error = src_ele->error;
}
-
void
copy_sspec(TSSspec *src, TSSspec *dst)
{
@@ -2452,7 +2442,6 @@ copy_congestion_ele(TSCongestionEle *ele)
return nele;
}
-
TSHostingEle *
copy_hosting_ele(TSHostingEle *ele)
{
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/CfgContextUtils.h
----------------------------------------------------------------------
diff --git a/mgmt/api/CfgContextUtils.h b/mgmt/api/CfgContextUtils.h
index 3fb4de0..e8487f4 100644
--- a/mgmt/api/CfgContextUtils.h
+++ b/mgmt/api/CfgContextUtils.h
@@ -131,7 +131,6 @@ char *admin_acc_type_to_string(TSAccessT access);
***************************************************************************/
Token *tokens_to_pdss_format(TokenList *tokens, Token *first_tok, TSPdSsFormat *pdss);
-
/***************************************************************************
* Validation Functions
***************************************************************************/
@@ -153,7 +152,6 @@ CfgEleObj *create_ele_obj_from_rule_node(Rule *rule);
CfgEleObj *create_ele_obj_from_ele(TSCfgEle *ele);
TSRuleTypeT get_rule_type(TokenList *token_list, TSFileNameT file);
-
/***************************************************************************
* Copy Helper Functions
***************************************************************************/
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/CoreAPI.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPI.cc b/mgmt/api/CoreAPI.cc
index 48da1e2..d9bad27 100644
--- a/mgmt/api/CoreAPI.cc
+++ b/mgmt/api/CoreAPI.cc
@@ -268,7 +268,6 @@ threads_for_process(pid_t proc)
}
}
-
done:
if (dir) {
closedir(dir);
@@ -357,8 +356,10 @@ ServerBacktrace(unsigned /* options */, char **trace)
{
*trace = NULL;
- // Unfortunately, we need to be privileged here. We either need to be root or to be holding
- // the CAP_SYS_PTRACE capability. Even though we are the parent traffic_manager, it is not
+ // Unfortunately, we need to be privileged here. We either need to be root or
+ // to be holding
+ // the CAP_SYS_PTRACE capability. Even though we are the parent
+ // traffic_manager, it is not
// traceable without privilege because the process credentials do not match.
ElevateAccess access(true, ElevateAccess::TRACE_PRIVILEGE);
threadlist threads(threads_for_process(lmgmt->watched_process_pid));
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/CoreAPI.h
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPI.h b/mgmt/api/CoreAPI.h
index cb5ee88..d8ef854 100644
--- a/mgmt/api/CoreAPI.h
+++ b/mgmt/api/CoreAPI.h
@@ -21,7 +21,6 @@
limitations under the License.
*/
-
#ifndef _CORE_API_H
#define _CORE_API_H
@@ -49,7 +48,8 @@ TSMgmtError ServerBacktrace(unsigned options, char **trace);
TSMgmtError Reconfigure(); // TS reread config files
TSMgmtError Restart(unsigned options); // restart TM
TSMgmtError Bounce(unsigned options); // restart traffic_server
-TSMgmtError StorageDeviceCmdOffline(const char *dev); // Storage device operation.
+TSMgmtError StorageDeviceCmdOffline(const char *dev); // Storage device
+ // operation.
/***************************************************************************
* Record Operations
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/CoreAPIRemote.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPIRemote.cc b/mgmt/api/CoreAPIRemote.cc
index 60592ad..0ae4ee5 100644
--- a/mgmt/api/CoreAPIRemote.cc
+++ b/mgmt/api/CoreAPIRemote.cc
@@ -192,7 +192,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
+ // 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();
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/CoreAPIShared.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/CoreAPIShared.cc b/mgmt/api/CoreAPIShared.cc
index 746dc60..c62f076 100644
--- a/mgmt/api/CoreAPIShared.cc
+++ b/mgmt/api/CoreAPIShared.cc
@@ -92,7 +92,8 @@ readHTTPResponse(int sock, char *buffer, int bufsize, uint64_t timeout)
// printf("before poll_read\n");
err = poll_read(sock, timeout);
if (err < 0) {
- // printf("(test) poll read failed [%d '%s']\n", errno, strerror (errno));
+ // printf("(test) poll read failed [%d '%s']\n", errno, strerror
+ // (errno));
goto error;
} else if (err == 0) {
// printf("(test) read timeout\n");
@@ -144,7 +145,8 @@ sendHTTPRequest(int sock, char *req, uint64_t timeout)
int err = poll_write(sock, timeout);
if (err < 0) {
- // printf("(test) poll write failed [%d '%s']\n", errno, strerror (errno));
+ // printf("(test) poll write failed [%d '%s']\n", errno, strerror
+ // (errno));
goto error;
} else if (err == 0) {
// printf("(test) write timeout\n");
@@ -158,7 +160,8 @@ sendHTTPRequest(int sock, char *req, uint64_t timeout)
} while ((err < 0) && ((errno == EINTR) || (errno == EAGAIN)));
if (err < 0) {
- // printf("(test) write failed [%d '%s']\n", errno, strerror (errno));
+ // printf("(test) write failed [%d '%s']\n", errno, strerror
+ // (errno));
goto error;
}
requestPtr += err;
@@ -175,7 +178,6 @@ error: /* "Houston, we have a problem!" (Apollo 13) */
return TS_ERR_NET_WRITE;
}
-
/* Modified from TrafficCop.cc (open_socket) */
int
connectDirect(const char *host, int port, uint64_t /* timeout ATS_UNUSED */)
@@ -188,7 +190,8 @@ connectDirect(const char *host, int port, uint64_t /* timeout ATS_UNUSED */)
} while ((sock < 0) && ((errno == EINTR) || (errno == EAGAIN)));
if (sock < 0) {
- // printf("(test) unable to create socket [%d '%s']\n", errno, strerror(errno));
+ // printf("(test) unable to create socket [%d '%s']\n", errno,
+ // strerror(errno));
goto error;
}
@@ -204,7 +207,8 @@ connectDirect(const char *host, int port, uint64_t /* timeout ATS_UNUSED */)
} while ((err < 0) && ((errno == EINTR) || (errno == EAGAIN)));
if (err < 0) {
- // printf("(test) unable to put socket in non-blocking mode [%d '%s']\n", errno, strerror (errno));
+ // printf("(test) unable to put socket in non-blocking mode [%d
+ // '%s']\n", errno, strerror (errno));
goto error;
}
// Connect to the specified port on the machine we're running on.
@@ -223,7 +227,8 @@ connectDirect(const char *host, int port, uint64_t /* timeout ATS_UNUSED */)
} while ((err < 0) && ((errno == EINTR) || (errno == EAGAIN)));
if ((err < 0) && (errno != EINPROGRESS)) {
- // printf("(test) unable to connect to server [%d '%s'] at port %d\n", errno, strerror (errno), port);
+ // printf("(test) unable to connect to server [%d '%s'] at port
+ // %d\n", errno, strerror (errno), port);
goto error;
}
return sock;
@@ -271,7 +276,6 @@ poll_write(int fd, int timeout)
err = poll(&info, 1, timeout);
} while ((err < 0) && ((errno == EINTR) || (errno == EAGAIN)));
-
if ((err > 0) && (info.revents & POLLOUT)) {
return 1;
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/EventCallback.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/EventCallback.cc b/mgmt/api/EventCallback.cc
index 4634cf3..894528f 100644
--- a/mgmt/api/EventCallback.cc
+++ b/mgmt/api/EventCallback.cc
@@ -35,7 +35,6 @@
#include "EventCallback.h"
#include "CoreAPIShared.h"
-
/**********************************************************************
* create_event_callback
*
@@ -92,7 +91,6 @@ create_callback_table(const char *lock_name)
return cb_table;
}
-
/**********************************************************************
* delete_callback_table
*
@@ -148,7 +146,8 @@ LLQ *
get_events_with_callbacks(CallbackTable *cb_table)
{
LLQ *cb_ev_list;
- bool all_events = true; // set to false if at least one event doesn't have registered callback
+ bool all_events = true; // set to false if at least one event doesn't have
+ // registered callback
cb_ev_list = create_queue();
for (int i = 0; i < NUM_EVENTS; i++) {
@@ -174,7 +173,8 @@ get_events_with_callbacks(CallbackTable *cb_table)
* purpose: Registers the specified function for the specified event in
* the specified callback list
* input: cb_list - the table of callbacks to store the callback fn
- * event_name - the event to store the callback for (if NULL, register for all events)
+ * event_name - the event to store the callback for (if NULL, register
+ *for all events)
* func - the callback function
* first_cb - true only if this is the event's first callback
* output: TS_ERR_xx
@@ -236,14 +236,14 @@ cb_table_register(CallbackTable *cb_table, const char *event_name, TSEventSignal
return TS_ERR_OKAY;
}
-
/**********************************************************************
* cb_table_unregister
*
* purpose: Unregisters the specified function for the specified event in
* the specified callback list
* input: cb_table - the table of callbacks to store the callback fn
- * event_name - the event to store the callback for (if NULL, register for all events)
+ * event_name - the event to store the callback for (if NULL, register
+ *for all events)
* func - the callback function
* first_cb - true only if this is the event's first callback
* output: TS_ERR_xx
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/EventControlMain.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/EventControlMain.cc b/mgmt/api/EventControlMain.cc
index 2f0ce77..3b46b65 100644
--- a/mgmt/api/EventControlMain.cc
+++ b/mgmt/api/EventControlMain.cc
@@ -308,7 +308,8 @@ event_callback_main(void *arg)
EventClientT *new_client_con = new_event_client();
if (!new_client_con) {
- // Debug ("TS_Control_Main", "can't create new EventClientT for new connection\n");
+ // Debug ("TS_Control_Main", "can't create new EventClientT for new
+ // connection\n");
} else {
// accept connection
new_con_fd = mgmt_accept(con_socket_fd, new_client_con->adr, &addr_len);
@@ -320,7 +321,8 @@ event_callback_main(void *arg)
// some other file descriptor; for each one, service request
if (fds_ready > 0) { // RECEIVED A REQUEST from remote API client
- // see if there are more fd to set - iterate through all entries in hash table
+ // see if there are more fd to set - iterate through all entries in hash
+ // table
con_entry = ink_hash_table_iterator_first(accepted_clients, &con_state);
while (con_entry) {
client_entry = (EventClientT *)ink_hash_table_entry_value(accepted_clients, con_entry);
@@ -349,7 +351,8 @@ event_callback_main(void *arg)
continue;
}
- } // end if(client_entry->fd && FD_ISSET(client_entry->fd, &selectFDs))
+ } // end if(client_entry->fd && FD_ISSET(client_entry->fd,
+ // &selectFDs))
con_entry = ink_hash_table_iterator_next(accepted_clients, &con_state);
} // end while (con_entry)
@@ -408,7 +411,8 @@ event_callback_main(void *arg)
// delete tables
delete_mgmt_events();
- // iterate through hash table; close client socket connections and remove entry
+ // iterate through hash table; close client socket connections and remove
+ // entry
con_entry = ink_hash_table_iterator_first(accepted_clients, &con_state);
while (con_entry) {
client_entry = (EventClientT *)ink_hash_table_entry_value(accepted_clients, con_entry);
@@ -433,7 +437,8 @@ event_callback_main(void *arg)
/**************************************************************************
* handle_event_reg_callback
*
- * purpose: handles request to register a callback for a specific event (or all events)
+ * purpose: handles request to register a callback for a specific event (or all
+ *events)
* input: client - the client currently reading the msg from
* req - the event_name
* output: TS_ERR_xx
@@ -451,7 +456,8 @@ handle_event_reg_callback(EventClientT *client, void *req, size_t reqlen)
goto done;
}
- // mark the specified alarm as "wanting to be notified" in the client's alarm_registered list
+ // mark the specified alarm as "wanting to be notified" in the client's
+ // alarm_registered list
if (strlen(name) == 0) { // mark all alarms
for (int i = 0; i < NUM_EVENTS; i++) {
client->events_registered[i] = true;
@@ -476,7 +482,8 @@ done:
/**************************************************************************
* handle_event_unreg_callback
*
- * purpose: handles request to unregister a callback for a specific event (or all events)
+ * purpose: handles request to unregister a callback for a specific event (or
+ *all events)
* input: client - the client currently reading the msg from
* req - the event_name
* output: TS_ERR_xx
@@ -494,7 +501,8 @@ handle_event_unreg_callback(EventClientT *client, void *req, size_t reqlen)
goto done;
}
- // mark the specified alarm as "wanting to be notified" in the client's alarm_registered list
+ // mark the specified alarm as "wanting to be notified" in the client's
+ // alarm_registered list
if (strlen(name) == 0) { // mark all alarms
for (int i = 0; i < NUM_EVENTS; i++) {
client->events_registered[i] = false;
@@ -562,7 +570,8 @@ handle_event_message(EventClientT *client, void *req, size_t reqlen)
uid_t euid = -1;
gid_t egid = -1;
- // For now, all event messages require privilege. This is compatible with earlier
+ // For now, all event messages require privilege. This is compatible with
+ // earlier
// versions of Traffic Server that always required privilege.
if (mgmt_get_peereid(client->fd, &euid, &egid) == -1 || (euid != 0 && euid != geteuid())) {
return TS_ERR_PERMISSION_DENIED;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/GenericParser.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/GenericParser.cc b/mgmt/api/GenericParser.cc
index eb97e4f..4d8a85c 100644
--- a/mgmt/api/GenericParser.cc
+++ b/mgmt/api/GenericParser.cc
@@ -223,7 +223,6 @@ Rule::parse(const char *const_rule, TSFileNameT filetype)
}
}
-
/**
* arm_securityParse
**/
@@ -265,7 +264,6 @@ Rule::arm_securityParse(char *rule)
return m_tokenList;
}
-
/**
* cacheParse
* CAUTION: This function is used for number of similar formatted
@@ -364,7 +362,6 @@ Rule::cacheParse(char *rule, unsigned short minNumToken, unsigned short maxNumTo
return m_tokenList;
}
-
/**
* congestionParse
**/
@@ -386,7 +383,6 @@ Rule::hostingParse(char *rule)
return cacheParse(rule, 2, 2);
}
-
/**
* icpParse
* - mimic proxy/ICPConfig/icp_config_change_callback
@@ -412,7 +408,6 @@ Rule::icpParse(char *rule, unsigned short minNumToken, unsigned short maxNumToke
return NULL;
}
-
m_tokenList = new TokenList();
for (; tokenStr; tokenStr = ruleTok.iterNext(&ruleTok_state)) {
token = new Token();
@@ -423,7 +418,6 @@ Rule::icpParse(char *rule, unsigned short minNumToken, unsigned short maxNumToke
return m_tokenList;
}
-
/**
* ip_allowParse
**/
@@ -436,7 +430,6 @@ Rule::ip_allowParse(char *rule)
return cacheParse(rule, 2, 2);
}
-
/**
* logsParse
**/
@@ -446,7 +439,6 @@ Rule::logsParse(char * /* rule ATS_UNUSED */)
return NULL;
}
-
/**
* log_hostsParse
**/
@@ -465,7 +457,6 @@ Rule::log_hostsParse(char *rule)
return m_tokenList;
}
-
/**
* logs_xmlParse
**/
@@ -475,7 +466,6 @@ Rule::logs_xmlParse(char * /* rule ATS_UNUSED */)
return NULL;
}
-
/**
* parentParse
**/
@@ -485,7 +475,6 @@ Rule::parentParse(char *rule)
return cacheParse(rule, 2);
}
-
/**
* volumeParse
**/
@@ -495,7 +484,6 @@ Rule::volumeParse(char *rule)
return cacheParse(rule, 3, 3);
}
-
/**
* pluginParse
**/
@@ -518,7 +506,6 @@ Rule::pluginParse(char *rule)
return m_tokenList;
}
-
/**
* remapParse
**/
@@ -560,7 +547,6 @@ Rule::remapParse(char *rule)
return m_tokenList;
}
-
/**
* socksParse
**/
@@ -575,7 +561,6 @@ Rule::socksParse(char *rule)
bool insideQuote = false;
const char *newStr;
-
if (numRuleTok < 2) {
setErrorHint("Expecting at least 2 space delimited tokens");
return NULL;
@@ -673,7 +658,6 @@ Rule::socksParse(char *rule)
return m_tokenList;
}
-
/**
* splitdnsParse
**/
@@ -759,7 +743,6 @@ Rule::splitdnsParse(char *rule)
// return cacheParse(rule, 2);
}
-
/**
* updateParse
**/
@@ -791,7 +774,6 @@ Rule::updateParse(char *rule)
return m_tokenList;
}
-
/**
* vaddrsParse
**/
@@ -817,7 +799,6 @@ Rule::vaddrsParse(char *rule)
return m_tokenList;
}
-
/**
* storageParse
* ------------
@@ -852,7 +833,6 @@ Rule::storageParse(char *rule)
return m_tokenList;
}
-
/*
* bool Rule::inQuote(char *str)
* Counts the number of quote found in "str"
@@ -871,7 +851,6 @@ Rule::inQuote(const char *str)
return (numQuote & 1);
}
-
/***************************************************************************
* RuleList
* a rule list is a list of rule; which compose to a configuration file.
@@ -990,7 +969,8 @@ RuleList::parse(char *fileBuf, TSFileNameT filetype)
rule->setRuleStr(line);
rule->tokenList = m_tokenList;
} else {
- // rule->setComment("## WARNING: The following configuration rule is invalid!");
+ // rule->setComment("## WARNING: The following configuration rule is
+ // invalid!");
size_t error_rule_size = sizeof(char) * (strlen(line) + strlen("#ERROR: ") + 1);
char *error_rule = (char *)ats_malloc(error_rule_size);
@@ -1009,7 +989,6 @@ RuleList::parse(char *fileBuf, TSFileNameT filetype)
// this->Print();
}
-
/***************************************************************************
* General Routines
***************************************************************************/
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/GenericParser.h
----------------------------------------------------------------------
diff --git a/mgmt/api/GenericParser.h b/mgmt/api/GenericParser.h
index 954681e..5ff7765 100644
--- a/mgmt/api/GenericParser.h
+++ b/mgmt/api/GenericParser.h
@@ -151,7 +151,6 @@ private:
Queue<Token> m_nameList;
};
-
/***************************************************************************
* Rule
* a rule is nothing more than just a token list. This object also
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/INKMgmtAPI.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/INKMgmtAPI.cc b/mgmt/api/INKMgmtAPI.cc
index d10bcf8..281aced 100644
--- a/mgmt/api/INKMgmtAPI.cc
+++ b/mgmt/api/INKMgmtAPI.cc
@@ -160,7 +160,8 @@ TSListIsValid(TSList l)
return true;
}
-/*--- TSIpAddrList operations -------------------------------------------------*/
+/*--- TSIpAddrList operations
+ * -------------------------------------------------*/
tsapi TSIpAddrList
TSIpAddrListCreate(void)
{
@@ -1621,7 +1622,8 @@ TSRecordSetMlt(TSList rec_list, TSActionNeedT *action_need)
enqueue((LLQ *)rec_list, ele);
}
- // set the action_need to be the most sever action needed of all the "set" calls
+ // set the action_need to be the most sever action needed of all the "set"
+ // calls
*action_need = top_action_req;
return status;
@@ -1894,7 +1896,8 @@ TSConfigFileWrite(TSFileNameT file, char *text, int size, int version)
* body - a buffer is allocated on the body char* pointer
* bodySize - the size of the body buffer is returned
* Output: TSMgmtError - TS_ERR_OKAY if succeed, TS_ERR_FAIL otherwise
- * Obsolete: tsapi TSMgmtError TSReadFromUrl (char *url, char **text, int *size);
+ * Obsolete: tsapi TSMgmtError TSReadFromUrl (char *url, char **text, int
+ * *size);
* NOTE: The URL can be expressed in the following forms:
* - http://www.example.com:80/products/network/index.html
* - http://www.example.com/products/network/index.html
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/NetworkMessage.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/NetworkMessage.cc b/mgmt/api/NetworkMessage.cc
index 160bed8..3f6d669 100644
--- a/mgmt/api/NetworkMessage.cc
+++ b/mgmt/api/NetworkMessage.cc
@@ -69,7 +69,8 @@ static const struct NetCmdOperation requests[] = {
/* RECORD_DESCRIBE_CONFIG */ {3, {MGMT_MARSHALL_INT, MGMT_MARSHALL_STRING, MGMT_MARSHALL_INT}},
};
-// Responses always begin with a TSMgmtError code, followed by additional fields.
+// Responses always begin with a TSMgmtError code, followed by additional
+// fields.
static const struct NetCmdOperation responses[] = {
/* FILE_READ */ {3, {MGMT_MARSHALL_INT, MGMT_MARSHALL_INT, MGMT_MARSHALL_DATA}},
/* FILE_WRITE */ {1, {MGMT_MARSHALL_INT}},
@@ -263,8 +264,10 @@ send_mgmt_error(int fd, OpType optype, TSMgmtError error)
return TS_ERR_FAIL;
}
-// Send a management message response. We don't need to worry about retransmitting the message if we get
-// disconnected, so this is much simpler. We can directly marshall the response as a data object.
+// Send a management message response. We don't need to worry about
+// retransmitting the message if we get
+// disconnected, so this is much simpler. We can directly marshall the response
+// as a data object.
TSMgmtError
send_mgmt_response(int fd, OpType optype, ...)
{
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/NetworkMessage.h
----------------------------------------------------------------------
diff --git a/mgmt/api/NetworkMessage.h b/mgmt/api/NetworkMessage.h
index 1aea548..73c9ef4 100644
--- a/mgmt/api/NetworkMessage.h
+++ b/mgmt/api/NetworkMessage.h
@@ -70,7 +70,8 @@ struct mgmt_message_sender {
virtual ~mgmt_message_sender(){};
};
-// Marshall and send a request, prefixing the message length as a MGMT_MARSHALL_INT.
+// Marshall and send a request, prefixing the message length as a
+// MGMT_MARSHALL_INT.
TSMgmtError send_mgmt_request(const mgmt_message_sender &snd, OpType optype, ...);
TSMgmtError send_mgmt_request(int fd, OpType optype, ...);
@@ -80,7 +81,8 @@ TSMgmtError send_mgmt_error(int fd, OpType op, TSMgmtError error);
// Parse a request message from a buffer.
TSMgmtError recv_mgmt_request(void *buf, size_t buflen, OpType optype, ...);
-// Marshall and send a response, prefixing the message length as a MGMT_MARSHALL_INT.
+// Marshall and send a response, prefixing the message length as a
+// MGMT_MARSHALL_INT.
TSMgmtError send_mgmt_response(int fd, OpType optype, ...);
// Parse a response message from a buffer.
@@ -89,7 +91,8 @@ TSMgmtError recv_mgmt_response(void *buf, size_t buflen, OpType optype, ...);
// Pull a management message (either request or response) off the wire.
TSMgmtError recv_mgmt_message(int fd, MgmtMarshallData &msg);
-// Extract the first MGMT_MARSHALL_INT from the buffered message. This is the OpType.
+// Extract the first MGMT_MARSHALL_INT from the buffered message. This is the
+// OpType.
OpType extract_mgmt_request_optype(void *msg, size_t msglen);
#endif /* _NETWORK_MESSAGE_H_ */
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/NetworkUtilsLocal.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/NetworkUtilsLocal.cc b/mgmt/api/NetworkUtilsLocal.cc
index 7bd6c81..09a0fda 100644
--- a/mgmt/api/NetworkUtilsLocal.cc
+++ b/mgmt/api/NetworkUtilsLocal.cc
@@ -44,11 +44,13 @@
* preprocess_msg
*
* purpose: reads in all the message; parses the message into header info
- * (OpType + msg_len) and the request portion (used by the handle_xx fns)
+ * (OpType + msg_len) and the request portion (used by the handle_xx
+ *fns)
* input: sock_info - socket msg is read from
* msg - the data from the network message (no OpType or msg_len)
* output: TS_ERR_xx ( if TS_ERR_OKAY, then parameters set successfully)
- * notes: Since preprocess_msg already removes the OpType and msg_len, this part o
+ * notes: Since preprocess_msg already removes the OpType and msg_len, this part
+ *o
* the message is not dealt with by the other parsing functions
**********************************************************************/
TSMgmtError
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/NetworkUtilsRemote.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/NetworkUtilsRemote.cc b/mgmt/api/NetworkUtilsRemote.cc
index 5d70366..49717f5 100644
--- a/mgmt/api/NetworkUtilsRemote.cc
+++ b/mgmt/api/NetworkUtilsRemote.cc
@@ -156,7 +156,8 @@ ts_connect()
#endif
// connect call
if (connect(event_socket_fd, (struct sockaddr *)&client_event_sock, sockaddr_len) < 0) {
- // fprintf(stderr, "[connect] ERROR (event_socket_fd %d): %s\n", event_socket_fd, strerror(int(errno)));
+ // fprintf(stderr, "[connect] ERROR (event_socket_fd %d): %s\n",
+ // event_socket_fd, strerror(int(errno)));
close(event_socket_fd);
close(main_socket_fd);
event_socket_fd = -1;
@@ -173,7 +174,8 @@ ERROR:
/***************************************************************************
* disconnect
*
- * purpose: disconnect from traffic server; closes sockets and resets their values
+ * purpose: disconnect from traffic server; closes sockets and resets their
+ *values
* input: None
* output: TS_ERR_FAIL, TS_ERR_OKAY
* notes: doesn't do clean up - all cleanup should be done before here
@@ -264,13 +266,15 @@ reconnect_loop(int num_attempts)
numTries++;
err = reconnect();
if (err == TS_ERR_OKAY) {
- // fprintf(stderr, "[reconnect_loop] Successful reconnction; Leave loop\n");
+ // fprintf(stderr, "[reconnect_loop] Successful reconnction; Leave
+ // loop\n");
return TS_ERR_OKAY; // successful connection
}
sleep(1); // to make it slower
}
- // fprintf(stderr, "[reconnect_loop] FAIL TO CONNECT after %d tries\n", num_attempts);
+ // fprintf(stderr, "[reconnect_loop] FAIL TO CONNECT after %d tries\n",
+ // num_attempts);
return err; // unsuccessful connection after num_attempts
}
@@ -641,7 +645,8 @@ event_poll_thread_main(void *arg)
event->id = get_event_id(name);
event->description = desc;
- // got event notice; spawn new thread to handle the event's callback functions
+ // got event notice; spawn new thread to handle the event's callback
+ // functions
ink_thread_create(event_callback_thread, (void *)event);
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/NetworkUtilsRemote.h
----------------------------------------------------------------------
diff --git a/mgmt/api/NetworkUtilsRemote.h b/mgmt/api/NetworkUtilsRemote.h
index 5c63c8e..4300490 100644
--- a/mgmt/api/NetworkUtilsRemote.h
+++ b/mgmt/api/NetworkUtilsRemote.h
@@ -56,7 +56,8 @@ void set_socket_paths(const char *path);
* the client connection information stored in the variables in
* NetworkUtilsRemote.cc
*/
-TSMgmtError ts_connect(); /* TODO: update documenation, Renamed due to conflict with connect() in <sys/socket.h> on some platforms*/
+TSMgmtError ts_connect(); /* TODO: update documenation, Renamed due to conflict with
+ connect() in <sys/socket.h> on some platforms*/
TSMgmtError disconnect();
TSMgmtError reconnect();
TSMgmtError reconnect_loop(int num_attempts);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/api/TSControlMain.cc
----------------------------------------------------------------------
diff --git a/mgmt/api/TSControlMain.cc b/mgmt/api/TSControlMain.cc
index a771ca3..eaf14c8 100644
--- a/mgmt/api/TSControlMain.cc
+++ b/mgmt/api/TSControlMain.cc
@@ -150,7 +150,8 @@ ts_ctrl_main(void *arg)
if (con_socket_fd >= 0) {
FD_SET(con_socket_fd, &selectFDs);
- // Debug("ts_main", "[ts_ctrl_main] add fd %d to select set\n", con_socket_fd);
+ // Debug("ts_main", "[ts_ctrl_main] add fd %d to select set\n",
+ // con_socket_fd);
}
// see if there are more fd to set
con_entry = ink_hash_table_iterator_first(accepted_con, &con_state);
@@ -189,7 +190,8 @@ ts_ctrl_main(void *arg)
// some other file descriptor; for each one, service request
if (fds_ready > 0) { // RECEIVED A REQUEST from remote API client
- // see if there are more fd to set - iterate through all entries in hash table
+ // see if there are more fd to set - iterate through all entries in hash
+ // table
con_entry = ink_hash_table_iterator_first(accepted_con, &con_state);
while (con_entry) {
Debug("ts_main", "[ts_ctrl_main] We have a remote client request!\n");
@@ -222,7 +224,8 @@ ts_ctrl_main(void *arg)
continue;
}
- } // end if(client_entry->fd && FD_ISSET(client_entry->fd, &selectFDs))
+ } // end if(client_entry->fd && FD_ISSET(client_entry->fd,
+ // &selectFDs))
con_entry = ink_hash_table_iterator_next(accepted_con, &con_state);
} // end while (con_entry)
@@ -236,7 +239,8 @@ ts_ctrl_main(void *arg)
Debug("ts_main", "[ts_ctrl_main] CLOSING AND SHUTTING DOWN OPERATIONS\n");
close_socket(con_socket_fd);
- // iterate through hash table; close client socket connections and remove entry
+ // iterate through hash table; close client socket connections and remove
+ // entry
con_entry = ink_hash_table_iterator_first(accepted_con, &con_state);
while (con_entry) {
client_entry = (ClientT *)ink_hash_table_entry_value(accepted_con, con_entry);
@@ -395,7 +399,8 @@ send_record_match(RecT /* rec_type */, void *edata, int /* registered */, const
match->err = send_record_get_response(match->fd, TS_REC_COUNTER, name, &(rec_val->rec_counter), sizeof(TSCounter));
break;
case RECD_STRING:
- // For NULL string parameters, end the literal "NULL" to match the behavior of MgmtRecordGet(). Make sure to send
+ // For NULL string parameters, end the literal "NULL" to match the
+ // behavior of MgmtRecordGet(). Make sure to send
// the trailing NULL.
if (rec_val->rec_string) {
match->err = send_record_get_response(match->fd, TS_REC_STRING, name, rec_val->rec_string, strlen(rec_val->rec_string) + 1);
@@ -1164,7 +1169,8 @@ handle_control_message(int fd, void *req, size_t reqlen)
uid_t euid = -1;
gid_t egid = -1;
- // For privileged calls, ensure we have caller credentials and that the caller is privileged.
+ // For privileged calls, ensure we have caller credentials and that the
+ // caller is privileged.
if (handlers[optype].flags & MGMT_API_PRIVILEGED) {
if (mgmt_get_peereid(fd, &euid, &egid) == -1 || (euid != 0 && euid != geteuid())) {
Debug("ts_main", "denied privileged API access on fd=%d for uid=%d gid=%d", fd, euid, egid);
@@ -1177,8 +1183,10 @@ handle_control_message(int fd, void *req, size_t reqlen)
error = handlers[optype].handler(fd, req, reqlen);
if (error != TS_ERR_OKAY) {
- // NOTE: if the error was produced by the handler sending a response, this could attempt to
- // send a response again. However, this would only happen if sending the response failed, so
+ // NOTE: if the error was produced by the handler sending a response, this
+ // could attempt to
+ // send a response again. However, this would only happen if sending the
+ // response failed, so
// it is safe to fail to send it again here ...
return send_mgmt_error(fd, optype, error);
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/cluster/ClusterCom.cc
----------------------------------------------------------------------
diff --git a/mgmt/cluster/ClusterCom.cc b/mgmt/cluster/ClusterCom.cc
index 5ec30ed..4734407 100644
--- a/mgmt/cluster/ClusterCom.cc
+++ b/mgmt/cluster/ClusterCom.cc
@@ -68,8 +68,10 @@ drainIncomingChannel_broadcast(void *arg)
for (;;) { /* Loop draining mgmt network channels */
int nevents = 0;
- // It's not clear whether this can happen, but historically, this code was written as if it
- // could. A hacky little sleep here will prevent this thread spinning on the read timeout.
+ // It's not clear whether this can happen, but historically, this code was
+ // written as if it
+ // could. A hacky little sleep here will prevent this thread spinning on the
+ // read timeout.
if (ccom->cluster_type == NO_CLUSTER || ccom->receive_fd == ts::NO_FD) {
mgmt_sleep_sec(1);
}
@@ -157,8 +159,10 @@ drainIncomingChannel(void *arg)
for (;;) { /* Loop draining mgmt network channels */
ink_zero(message);
- // It's not clear whether this can happen, but historically, this code was written as if it
- // could. A hacky little sleep here will prevent this thread spinning on the read timeout.
+ // It's not clear whether this can happen, but historically, this code was
+ // written as if it
+ // could. A hacky little sleep here will prevent this thread spinning on the
+ // read timeout.
if (ccom->cluster_type == NO_CLUSTER || ccom->reliable_server_fd == ts::NO_FD) {
mgmt_sleep_sec(1);
}
@@ -288,20 +292,25 @@ drainIncomingChannel(void *arg)
if (buff)
delete buff;
} else if (strstr(message, "cmd: shutdown_manager")) {
- mgmt_log("[ClusterCom::drainIncomingChannel] Received manager shutdown request\n");
+ mgmt_log("[ClusterCom::drainIncomingChannel] Received manager "
+ "shutdown request\n");
lmgmt->mgmt_shutdown_outstanding = MGMT_PENDING_RESTART;
} else if (strstr(message, "cmd: shutdown_process")) {
- mgmt_log("[ClusterCom::drainIncomingChannel] Received process shutdown request\n");
+ mgmt_log("[ClusterCom::drainIncomingChannel] Received process "
+ "shutdown request\n");
lmgmt->processShutdown();
} else if (strstr(message, "cmd: restart_process")) {
- mgmt_log("[ClusterCom::drainIncomingChannel] Received restart process request\n");
+ mgmt_log("[ClusterCom::drainIncomingChannel] Received restart "
+ "process request\n");
lmgmt->processRestart();
} else if (strstr(message, "cmd: bounce_process")) {
- mgmt_log("[ClusterCom::drainIncomingChannel] Received bounce process request\n");
+ mgmt_log("[ClusterCom::drainIncomingChannel] Received bounce process "
+ "request\n");
lmgmt->processBounce();
} else if (strstr(message, "cmd: clear_stats")) {
char sname[1024];
- mgmt_log("[ClusterCom::drainIncomingChannel] Received clear stats request\n");
+ mgmt_log("[ClusterCom::drainIncomingChannel] Received clear stats "
+ "request\n");
if (sscanf(message, "cmd: clear_stats %1023s", sname) != 1) {
lmgmt->clearStats(sname);
} else {
@@ -322,7 +331,6 @@ drainIncomingChannel(void *arg)
return NULL;
} /* End drainIncomingChannel */
-
/*
* cluster_com_port_watcher(...)
* This function watches updates and changes that are made to the
@@ -343,7 +351,6 @@ cluster_com_port_watcher(const char *name, RecDataT /* data_type ATS_UNUSED */,
return 0;
} /* End cluster_com_port_watcher */
-
ClusterCom::ClusterCom(unsigned long oip, char *host, int mcport, char *group, int rsport, char *p)
: our_wall_clock(0), alive_peers_count(0), reliable_server_fd(0), broadcast_fd(0), receive_fd(0)
{
@@ -354,7 +361,8 @@ ClusterCom::ClusterCom(unsigned long oip, char *host, int mcport, char *group, i
if (strlen(host) >= 1024) {
mgmt_fatal(stderr, 0, "[ClusterCom::ClusterCom] Hostname too large: %s\n", host);
}
- // the constructor does a memset() on broadcast_addr and receive_addr, initializing them
+ // the constructor does a memset() on broadcast_addr and receive_addr,
+ // initializing them
// coverity[uninit_member]
memset(&broadcast_addr, 0, sizeof(broadcast_addr));
memset(&receive_addr, 0, sizeof(receive_addr));
@@ -390,7 +398,8 @@ ClusterCom::ClusterCom(unsigned long oip, char *host, int mcport, char *group, i
found = (rec_err == REC_ERR_OKAY);
if (!found) {
- mgmt_fatal(stderr, 0, "[ClusterCom::ClusterCom] no cluster_configuration filename configured\n");
+ mgmt_fatal(stderr, 0, "[ClusterCom::ClusterCom] no cluster_configuration "
+ "filename configured\n");
}
if (strlen(p) + strlen(cluster_file) >= 1024) {
@@ -467,7 +476,6 @@ ClusterCom::ClusterCom(unsigned long oip, char *host, int mcport, char *group, i
return;
} /* End ClusterCom::ClusterCom */
-
/*
* checkPeers(...)
* Function checks on our peers by racing through the peer list(ht) and
@@ -482,8 +490,10 @@ ClusterCom::checkPeers(time_t *ticker)
InkHashTableEntry *entry;
InkHashTableIteratorState iterator_state;
- // Hack in the file manager in case the rollback needs to send a notification. This is definitely
- // a hack, but it helps break the dependency on global FileManager in traffic_manager.
+ // Hack in the file manager in case the rollback needs to send a notification.
+ // This is definitely
+ // a hack, but it helps break the dependency on global FileManager in
+ // traffic_manager.
cluster_file_rb->configFiles = configFiles;
if (cluster_type == NO_CLUSTER)
@@ -585,7 +595,6 @@ ClusterCom::checkPeers(time_t *ticker)
}
}
-
if (num_peers == number_of_nodes) {
/*
* If the number of peers in the hash_table is the same as the
@@ -629,9 +638,11 @@ ClusterCom::checkPeers(time_t *ticker)
if (signal_alarm) {
/*
lmgmt->alarm_keeper->signalAlarm(MGMT_ALARM_PROXY_SYSTEM_ERROR,
- "[TrafficManager] Unable to write cluster.config, membership unchanged");
+ "[TrafficManager] Unable to write
+ cluster.config, membership unchanged");
*/
- mgmt_elog(0, "[TrafficManager] Unable to write cluster.config, membership unchanged");
+ mgmt_elog(0, "[TrafficManager] Unable to write cluster.config, "
+ "membership unchanged");
}
*ticker = t;
}
@@ -658,7 +669,6 @@ ClusterCom::checkPeers(time_t *ticker)
return;
} /* End ClusterCom::checkPeers */
-
void
ClusterCom::generateClusterDelta(void)
{
@@ -691,7 +701,6 @@ ClusterCom::generateClusterDelta(void)
} /* End ClusterCom::generateClusterDelta */
-
/*
* handleMultCastMessage(...)
* Function is called to handle(parse) messages received from the broadcast
@@ -778,7 +787,8 @@ ClusterCom::handleMultiCastMessage(char *message)
if (!strstr(line, "os: ") || !strstr(line, sys_name)) {
/*
lmgmt->alarm_keeper->signalAlarm(MGMT_ALARM_PROXY_SYSTEM_ERROR,
- "Received Multicast message from peer running mis-match"
+ "Received Multicast message from peer
+ running mis-match"
" Operating system, please investigate");
*/
Debug("ccom", "[ClusterCom::handleMultiCastMessage] Received message from peer "
@@ -791,8 +801,10 @@ ClusterCom::handleMultiCastMessage(char *message)
if (!strstr(line, "rel: ") || !strstr(line, sys_release)) {
/*
lmgmt->alarm_keeper->signalAlarm(MGMT_ALARM_PROXY_SYSTEM_ERROR,
- "Received Multicast message from peer running mis-match"
- " Operating system release, please investigate");
+ "Received Multicast message from peer
+ running mis-match"
+ " Operating system release, please
+ investigate");
*/
Debug("ccom", "[ClusterCom::handleMultiCastMessage] Received message from peer "
"running different os/release '%s'(ours os: '%s' rel: '%s'\n",
@@ -838,8 +850,10 @@ ClusterCom::handleMultiCastMessage(char *message)
p->num_virt_addrs = 0;
// Safe since these are completely static
- // TODO: This might no longer be completely optimal, since we don't keep track of
- // how many RECT_NODE stats there are. I'm hoping it's negligible though, but worst
+ // TODO: This might no longer be completely optimal, since we don't keep
+ // track of
+ // how many RECT_NODE stats there are. I'm hoping it's negligible though,
+ // but worst
// case we can reoptimize this later (and more efficiently).
int cnt = 0;
p->node_rec_data.recs = (RecRecord *)ats_malloc(sizeof(RecRecord) * g_num_records);
@@ -899,7 +913,6 @@ Lbogus:
}
} /* End ClusterCom::handleMultiCastMessage */
-
/*
* handleMultiCastStatPacket(...)
* Function groks the stat packets received on the mc channel and updates
@@ -935,7 +948,9 @@ ClusterCom::handleMultiCastStatPacket(char *last, ClusterPeerInfo *peer)
tmp_msg_val = ink_atoi64(v3 + 1);
}
if (!v2 || !v3) {
- mgmt_elog(0, "[ClusterCom::handleMultiCastStatPacket] Invalid message-line(%d) '%s'\n", __LINE__, line);
+ mgmt_elog(0, "[ClusterCom::handleMultiCastStatPacket] Invalid "
+ "message-line(%d) '%s'\n",
+ __LINE__, line);
return;
}
ink_assert(i == tmp_id && rec->data_type == tmp_type);
@@ -956,7 +971,9 @@ ClusterCom::handleMultiCastStatPacket(char *last, ClusterPeerInfo *peer)
// the types specified are all have a defined constant size
// coverity[secure_coding]
if (sscanf(line, "%d:%d: %f", &tmp_id, (int *)&tmp_type, &tmp_msg_val) != 3) {
- mgmt_elog(0, "[ClusterCom::handleMultiCastStatPacket] Invalid message-line(%d) '%s'\n", __LINE__, line);
+ mgmt_elog(0, "[ClusterCom::handleMultiCastStatPacket] Invalid "
+ "message-line(%d) '%s'\n",
+ __LINE__, line);
return;
}
ink_assert(i == tmp_id && rec->data_type == tmp_type);
@@ -975,7 +992,9 @@ ClusterCom::handleMultiCastStatPacket(char *last, ClusterPeerInfo *peer)
// the types specified are all have a defined constant size
// coverity[secure_coding]
if (sscanf(line, "%d:%d: %n", &tmp_id, (int *)&tmp_type, &ccons) != 2) {
- mgmt_elog(0, "[ClusterCom::handleMultiCastStatPacket] Invalid message-line(%d) '%s'\n", __LINE__, line);
+ mgmt_elog(0, "[ClusterCom::handleMultiCastStatPacket] Invalid "
+ "message-line(%d) '%s'\n",
+ __LINE__, line);
return;
}
tmp_msg_val = &line[ccons];
@@ -1137,7 +1156,9 @@ ClusterCom::handleMultiCastFilePacket(char *last, char *ip)
file_update_failure = false;
// coverity[secure_coding]
if (sscanf(line, "%1023s %d %" PRId64 "\n", file, &ver, &tt) != 3) {
- mgmt_elog(0, "[ClusterCom::handleMultiCastFilePacket] Invalid message-line(%d) '%s'\n", __LINE__, line);
+ mgmt_elog(0, "[ClusterCom::handleMultiCastFilePacket] Invalid "
+ "message-line(%d) '%s'\n",
+ __LINE__, line);
return;
}
@@ -1145,15 +1166,15 @@ ClusterCom::handleMultiCastFilePacket(char *last, char *ip)
our_ver = rb->getCurrentVersion();
if (ver > our_ver) { /* Their version is newer */
/*
- * FIX: we have the timestamp from them as well, should we also
- * figure that into this? or are version numbers sufficient?
- *
- * (mod > rb->versionTimeStamp(our_ver)
- *
- * When fixing this, watch out for the workaround put in place
- * for INKqa08567. File timestamps aren't sent around the
- * cluster anymore.
- */
+ * FIX: we have the timestamp from them as well, should we also
+ * figure that into this? or are version numbers sufficient?
+ *
+ * (mod > rb->versionTimeStamp(our_ver)
+ *
+ * When fixing this, watch out for the workaround put in place
+ * for INKqa08567. File timestamps aren't sent around the
+ * cluster anymore.
+ */
char message[1024];
textBuffer *reply = new textBuffer(2048); /* Start with 2k file size */
snprintf(message, sizeof(message), "file: %s %d", file, ver);
@@ -1230,7 +1251,6 @@ ClusterCom::handleMultiCastFilePacket(char *last, char *ip)
return;
} /* End ClusterCom::handleMultiCastFilePacket */
-
/*
* handleMultiCastAlarmPacket(...)
* Function receives incoming alarm messages and updates the alarms class.
@@ -1253,7 +1273,9 @@ ClusterCom::handleMultiCastAlarmPacket(char *last, char *ip)
// both types have a finite size
// coverity[secure_coding]
if (sscanf(line, "alarm: %d %n", &a, &ccons) != 1) {
- mgmt_elog(0, "[ClusterCom::handleMultiCastAlarmPacket] Invalid message-line(%d) '%s'\n", __LINE__, line);
+ mgmt_elog(0, "[ClusterCom::handleMultiCastAlarmPacket] Invalid "
+ "message-line(%d) '%s'\n",
+ __LINE__, line);
return;
}
@@ -1267,7 +1289,6 @@ ClusterCom::handleMultiCastAlarmPacket(char *last, char *ip)
return;
} /* End ClusterCom::handleMultiCastAlarmPacket */
-
/*
* handleMultiCastVMapPacket(...)
* Handles incoming reports from peers about which virtual interfaces
@@ -1292,7 +1313,9 @@ ClusterCom::handleMultiCastVMapPacket(char *last, char *ip)
}
// coverity[secure_coding]
if (sscanf(line, "virt: %79s", vaddr) != 1) {
- mgmt_elog(0, "[ClusterCom::handleMultiCastVMapPacket] Invalid message-line(%d) '%s'\n", __LINE__, line);
+ mgmt_elog(0, "[ClusterCom::handleMultiCastVMapPacket] Invalid "
+ "message-line(%d) '%s'\n",
+ __LINE__, line);
return;
}
@@ -1309,7 +1332,6 @@ ClusterCom::handleMultiCastVMapPacket(char *last, char *ip)
return;
} /* End ClusterCom::handleMultiCastVMapPacket */
-
/*
* sendSharedData
* Function serves as aggregator of NODE data to be shared with the
@@ -1380,7 +1402,6 @@ ClusterCom::sendSharedData(bool send_proxy_heart_beat)
return true;
} /* End ClusterCom::sendSharedData */
-
/*
* constructSharedGenericPacket(...)
* A generic packet builder that can construct config or stat
@@ -1415,7 +1436,6 @@ ClusterCom::constructSharedGenericPacket(char *message, int max, RecT packet_typ
running_sum += strlen(tmp);
ink_release_assert(running_sum < max);
-
if (sys_release[0]) {
snprintf(tmp, sizeof(tmp), "rel: %s\n", sys_release);
} else {
@@ -1491,7 +1511,6 @@ ClusterCom::constructSharedGenericPacket(char *message, int max, RecT packet_typ
return;
} /* End ClusterCom::constructSharedGenericPacket */
-
void
ClusterCom::constructSharedStatPacket(char *message, int max)
{
@@ -1499,7 +1518,6 @@ ClusterCom::constructSharedStatPacket(char *message, int max)
return;
} /* End ClusterCom::constructSharedStatPacket */
-
/* static int constructSharedPacketHeader(...)
* Each multicast packet needs to have the following
* header info. Ip, Cluster Name, TS Version. This function
@@ -1520,7 +1538,6 @@ ClusterCom::constructSharedPacketHeader(const AppVersionInfo &version, char *mes
return running_sum;
} /* End ClusterCom::constructSharedPacketHeader */
-
/*
* constructSharedFilePacket(...)
* Foreach of the config files we are holding build a packet that
@@ -1590,7 +1607,6 @@ ClusterCom::constructSharedFilePacket(char *message, int max)
return;
} /* End ClusterCom::constructSharedFilePacket */
-
/*
* estabilishChannels(...)
* Sets up the multi-cast and reliable tcp channels for cluster
@@ -1639,7 +1655,6 @@ ClusterCom::establishChannels()
return;
}
-
/*
* establishBroadcastChannel()
* Setup our multicast channel for broadcasting.
@@ -1652,12 +1667,14 @@ ClusterCom::establishBroadcastChannel(void)
}
if (fcntl(broadcast_fd, F_SETFD, 1) < 0) {
- mgmt_fatal(errno, "[ClusterCom::establishBroadcastChannel] Unable to set close-on-exec.\n");
+ mgmt_fatal(errno, "[ClusterCom::establishBroadcastChannel] Unable to set "
+ "close-on-exec.\n");
}
int one = 1;
if (setsockopt(broadcast_fd, SOL_SOCKET, SO_REUSEADDR, (const char *)&one, sizeof(one)) < 0) {
- mgmt_fatal(errno, "[ClusterCom::establishBroadcastChannel] Unable to set socket options.\n");
+ mgmt_fatal(errno, "[ClusterCom::establishBroadcastChannel] Unable to set "
+ "socket options.\n");
}
memset(&broadcast_addr, 0, sizeof(broadcast_addr));
@@ -1669,7 +1686,8 @@ ClusterCom::establishBroadcastChannel(void)
/* Set ttl(max forwards), 1 should be default(same subnetwork). */
if (setsockopt(broadcast_fd, IPPROTO_IP, IP_MULTICAST_TTL, (const char *)&ttl, sizeof(ttl)) < 0) {
- mgmt_fatal(errno, "[ClusterCom::establishBroadcastChannel] Unable to setsocketopt, ttl\n");
+ mgmt_fatal(errno, "[ClusterCom::establishBroadcastChannel] Unable to "
+ "setsocketopt, ttl\n");
}
/* Disable broadcast loopback, that is broadcasting to self */
@@ -1680,7 +1698,6 @@ ClusterCom::establishBroadcastChannel(void)
return;
} /* End ClusterCom::establishBroadcastChannel */
-
/*
* establishReceiveChannel()
* Setup our multicast channel for receiving incoming broadcasts
@@ -1716,7 +1733,8 @@ ClusterCom::establishReceiveChannel(int fatal_on_error)
Debug("ccom", "establishReceiveChannel: Unable to set socket to reuse addr");
return 1;
}
- mgmt_fatal(errno, "[ClusterCom::establishReceiveChannel] Unable to set socket to reuse addr.\n");
+ mgmt_fatal(errno, "[ClusterCom::establishReceiveChannel] Unable to set "
+ "socket to reuse addr.\n");
}
memset(&receive_addr, 0, sizeof(receive_addr));
@@ -1731,7 +1749,9 @@ ClusterCom::establishReceiveChannel(int fatal_on_error)
Debug("ccom", "establishReceiveChannel: Unable to bind to socket, port %d", mc_port);
return 1;
}
- mgmt_fatal(errno, "[ClusterCom::establishReceiveChannel] Unable to bind to socket, port %d\n", mc_port);
+ mgmt_fatal(errno, "[ClusterCom::establishReceiveChannel] Unable to bind to "
+ "socket, port %d\n",
+ mc_port);
}
/* Add ourselves to the group */
struct ip_mreq mc_request;
@@ -1745,13 +1765,14 @@ ClusterCom::establishReceiveChannel(int fatal_on_error)
return 1;
}
- mgmt_fatal(errno, "[ClusterCom::establishReceiveChannel] Can't add ourselves to multicast group %s\n", mc_group);
+ mgmt_fatal(errno, "[ClusterCom::establishReceiveChannel] Can't add "
+ "ourselves to multicast group %s\n",
+ mc_group);
}
return 0;
} /* End ClusterCom::establishReceiveChannel */
-
/*
* sendOutgoingMessage
* Function basically writes a message to the broadcast_fd, it is blocking,
@@ -1768,7 +1789,6 @@ ClusterCom::sendOutgoingMessage(char *buf, int len)
return true;
} /* End ClusterCom::sendOutgoingMessage */
-
bool
ClusterCom::sendClusterMessage(int msg_type, const char *args)
{
@@ -1809,7 +1829,8 @@ ClusterCom::sendClusterMessage(int msg_type, const char *args)
tmp_ret = rl_sendReliableMessage(tmp->inet_address, msg, strlen(msg));
if (tmp->num_virt_addrs != -1) {
- /* Only change return val if he is not dead, if dead manager could be up. */
+ /* Only change return val if he is not dead, if dead manager could be up.
+ */
ret = tmp_ret;
}
}
@@ -1836,7 +1857,6 @@ ClusterCom::sendClusterMessage(int msg_type, const char *args)
return ret;
} /* End ClusterCom::sendClusterMessage */
-
bool
ClusterCom::sendReliableMessage(unsigned long addr, char *buf, int len)
{
@@ -1873,7 +1893,6 @@ ClusterCom::rl_sendReliableMessage(unsigned long addr, const char *buf, int len)
serv_addr.sin_addr.s_addr = addr;
serv_addr.sin_port = htons(cport);
-
if ((fd = mgmt_socket(AF_INET, SOCK_STREAM, 0)) < 0) {
mgmt_elog(errno, "[ClusterCom::rl_sendReliableMessage] Unable to create socket\n");
return false;
@@ -1899,7 +1918,6 @@ ClusterCom::rl_sendReliableMessage(unsigned long addr, const char *buf, int len)
return true;
} /* End ClusterCom::rl_sendReliableMessage */
-
/*
* sendReliableMessage(...)
* Used to send a string across the reliable fd.
@@ -1983,7 +2001,6 @@ ClusterCom::sendReliableMessage(unsigned long addr, char *buf, int len, char *re
return true;
} /* End ClusterCom::sendReliableMessage */
-
/*
* sendReliableMessage(...)
* Used to send a string across the reliable fd.
@@ -2017,7 +2034,8 @@ ClusterCom::sendReliableMessageReadTillClose(unsigned long addr, char *buf, int
return false;
}
if (fcntl(fd, F_SETFD, 1) < 0) {
- mgmt_elog(errno, "[ClusterCom::sendReliableMessageReadTillClose] Unable to set close-on-exec.\n");
+ mgmt_elog(errno, "[ClusterCom::sendReliableMessageReadTillClose] Unable to "
+ "set close-on-exec.\n");
ink_mutex_release(&mutex);
close(fd);
return false;
@@ -2036,7 +2054,9 @@ ClusterCom::sendReliableMessageReadTillClose(unsigned long addr, char *buf, int
close_socket(fd);
return false;
} else {
- Debug("ccom", "[ClusterCom::sendReliableMessageREadTillClose] Sent '%s' len: %d on fd: %d\n", buf, len, fd);
+ Debug("ccom", "[ClusterCom::sendReliableMessageREadTillClose] Sent '%s' "
+ "len: %d on fd: %d\n",
+ buf, len, fd);
}
memset(tmp_reply, 0, 1024);
@@ -2061,7 +2081,6 @@ ClusterCom::sendReliableMessageReadTillClose(unsigned long addr, char *buf, int
return true;
} /* End ClusterCom::sendReliableMessageReadTillClose */
-
/*
* receiveIncomingMessage
* This function reads from the incoming channel. It is blocking,
@@ -2078,7 +2097,6 @@ ClusterCom::receiveIncomingMessage(char *buf, int max)
return nbytes;
} /* End ClusterCom::processIncomingMessages */
-
/*
* isMaster()
* Function checks known hosts and decides whether this local manager is
@@ -2112,7 +2130,6 @@ ClusterCom::isMaster()
return false;
} /* End ClusterCom::isMaster */
-
/*
* lowestPeer()
* Function finds the peer with the lowest number of current virtual
@@ -2148,7 +2165,6 @@ ClusterCom::lowestPeer(int *no)
return min_ip;
} /* End ClusterCom::lowestPeer */
-
void
ClusterCom::logClusterMismatch(const char *ip, ClusterMismatch type, char *data)
{
@@ -2187,7 +2203,6 @@ ClusterCom::logClusterMismatch(const char *ip, ClusterMismatch type, char *data)
ink_hash_table_insert(mismatchLog, ip, (void *)type);
}
-
/*
* highestPeer()
* Function finds the peer with the highest number of current virtual
@@ -2224,7 +2239,6 @@ ClusterCom::highestPeer(int *no)
return max_ip;
} /* End ClusterCom::highestPeer */
-
/*
* checkBackDoor(...)
* Function checks for "backdoor" commands on the cluster port.
@@ -2369,7 +2383,6 @@ checkBackDoor(int req_fd, char *message)
(int64_t)tmp->idle_ticks, tmp->last_time_recorded, tmp->delta, (int64_t)tmp->manager_idle_ticks, tmp->manager_alive);
mgmt_writeline(req_fd, reply, strlen(reply));
-
tmp_msg = "---------------------------\n";
mgmt_writeline(req_fd, tmp_msg, strlen(tmp_msg));
}
@@ -2397,7 +2410,8 @@ checkBackDoor(int req_fd, char *message)
mgmt_writeline(req_fd, reply, strlen(reply));
// XXX: Again multiple code caused by misssing PID_T_FMT
-// TODO: Was #if defined(solaris) && (!defined(_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64)
+// TODO: Was #if defined(solaris) && (!defined(_FILE_OFFSET_BITS) ||
+// _FILE_OFFSET_BITS != 64)
#if defined(solaris)
snprintf(reply, sizeof(reply), "\twatched_process_fd: %d watched_process_pid: %ld\n", lmgmt->watched_process_fd,
(long int)lmgmt->watched_process_pid);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/cluster/ClusterCom.h
----------------------------------------------------------------------
diff --git a/mgmt/cluster/ClusterCom.h b/mgmt/cluster/ClusterCom.h
index 7687f2f..599f399 100644
--- a/mgmt/cluster/ClusterCom.h
+++ b/mgmt/cluster/ClusterCom.h
@@ -58,12 +58,17 @@ class FileManager;
#define MAX_MC_GROUP_LEN 20
#define MAX_NODE_SYSINFO_STRING 32
-#define CLUSTER_CONFIG_FILE_BLURB \
- "# Cluster Configuration file\n#\n# This file is machine generated and machine parsed.\n# Please do not change this file by " \
- "hand.\n#\n# This file designates the machines which make up the cluster\n# proper. Data and load are distributed among these " \
- "machines.\n#\n############################################################################\n# Number\n# IP:Port \n# " \
- "...\n############################################################################\n# Number = { 0, 1 ... } where 0 is a " \
- "stand-alone proxy\n# IP:Port = IP address: cluster accept port number\n#\n# Example 1: stand-alone proxy\n# 0\n#\n# Example " \
+#define CLUSTER_CONFIG_FILE_BLURB \
+ "# Cluster Configuration file\n#\n# This file is machine generated and " \
+ "machine parsed.\n# Please do not change this file by " \
+ "hand.\n#\n# This file designates the machines which make up the " \
+ "cluster\n# proper. Data and load are distributed among these " \
+ "machines.\n#\n############################################################" \
+ "################\n# Number\n# IP:Port \n# " \
+ "...\n#####################################################################" \
+ "#######\n# Number = { 0, 1 ... } where 0 is a " \
+ "stand-alone proxy\n# IP:Port = IP address: cluster accept port " \
+ "number\n#\n# Example 1: stand-alone proxy\n# 0\n#\n# Example " \
"2: 3 machines\n# 3\n# 127.1.2.3:83\n# 127.1.2.4:83\n# 127.1.2.5:83\n#\n"
enum MgmtClusterType {
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/cluster/VMap.cc
----------------------------------------------------------------------
diff --git a/mgmt/cluster/VMap.cc b/mgmt/cluster/VMap.cc
index 710a44f..2fa9b40 100644
--- a/mgmt/cluster/VMap.cc
+++ b/mgmt/cluster/VMap.cc
@@ -57,7 +57,6 @@ vmapEnableHandler(const char *tok, RecDataT /* data_type ATS_UNUSED */, RecData
return 0;
} /* End vmapEnableHandler */
-
VMap::VMap(char *interface, unsigned long ip, ink_mutex *m)
{
bool found;
@@ -77,7 +76,6 @@ VMap::VMap(char *interface, unsigned long ip, ink_mutex *m)
num_addrs = 0;
num_nics = 0;
-
this->interface = ats_strdup(interface);
turning_off = false; // we are not turning off VIP
@@ -103,8 +101,9 @@ VMap::VMap(char *interface, unsigned long ip, ink_mutex *m)
num_nics++;
ink_hash_table_insert(interface_realip_map, interface, (void *)tmp_realip_info);
if (enabled) {
- mgmt_log("[VMap::Vmap] Added cluster interface '%s' real ip: '%s' to known interfaces\n", interface,
- inet_ntoa(tmp_realip_info->real_ip));
+ mgmt_log("[VMap::Vmap] Added cluster interface '%s' real ip: '%s' to "
+ "known interfaces\n",
+ interface, inet_ntoa(tmp_realip_info->real_ip));
}
}
{
@@ -152,7 +151,9 @@ VMap::VMap(char *interface, unsigned long ip, ink_mutex *m)
// Get the address of the interface
if (ioctl(tmp_socket, SIOCGIFADDR, (char *)ifr) < 0) {
- mgmt_log("[VMap::VMap] Unable obtain address for network interface %s, presuming unused\n", ifr->ifr_name);
+ mgmt_log("[VMap::VMap] Unable obtain address for network interface "
+ "%s, presuming unused\n",
+ ifr->ifr_name);
} else {
InkHashTableValue hash_value;
@@ -177,8 +178,9 @@ VMap::VMap(char *interface, unsigned long ip, ink_mutex *m)
ink_hash_table_insert(interface_realip_map, ifr->ifr_name, (void *)tmp_realip_info);
num_nics++;
if (enabled) {
- mgmt_log("[VMap::Vmap] Added interface '%s' real ip: '%s' to known interfaces\n", ifr->ifr_name,
- inet_ntoa(tmp_realip_info->real_ip));
+ mgmt_log("[VMap::Vmap] Added interface '%s' real ip: '%s' to "
+ "known interfaces\n",
+ ifr->ifr_name, inet_ntoa(tmp_realip_info->real_ip));
}
}
} else {
@@ -198,7 +200,6 @@ VMap::VMap(char *interface, unsigned long ip, ink_mutex *m)
close(tmp_socket);
}
-
RecRegisterConfigUpdateCb("proxy.config.vmap.enabled", vmapEnableHandler, NULL);
down_up_timeout = REC_readInteger("proxy.config.vmap.down_up_timeout", &found);
@@ -212,7 +213,6 @@ VMap::VMap(char *interface, unsigned long ip, ink_mutex *m)
} /* End VMap::VMap */
-
VMap::~VMap()
{
if (id_map)
@@ -225,7 +225,6 @@ VMap::~VMap()
ats_free(addr_list);
} /* End VMap::~VMap */
-
/*
* lt_runGambit()
* Function basically runs the virtual ip assignment gambit. If you are
@@ -242,7 +241,6 @@ VMap::lt_runGambit()
bool init = false;
struct in_addr virtual_addr, real_addr;
-
if (!enabled) {
return;
}
@@ -282,13 +280,14 @@ VMap::lt_runGambit()
}
}
-
for (i = 0; i < num_addrs; i++) { /* Check for conflicts with your interfaces */
virtual_addr.s_addr = addr_list[i];
ink_strlcpy(vaddr, inet_ntoa(virtual_addr), sizeof(vaddr));
if ((conf_addr = rl_checkConflict(vaddr))) {
- mgmt_log(stderr, "[VMap::lt_runGambit] Conflict w/addr: '%s' - Unable to use virtual address.\n", vaddr);
+ mgmt_log(stderr, "[VMap::lt_runGambit] Conflict w/addr: '%s' - Unable to "
+ "use virtual address.\n",
+ vaddr);
ats_free(conf_addr);
break;
}
@@ -298,7 +297,6 @@ VMap::lt_runGambit()
return;
} /* End VMap::lt_runGambit */
-
/*
* lt_readAListFile(...)
* Function reads in the virtual ip list, basically a parsing routine for the
@@ -315,7 +313,9 @@ VMap::lt_readAListFile(const char *fname)
ats_scoped_str vaddr_path(RecConfigReadConfigPath(NULL, fname));
if (!(fin = fopen(vaddr_path, "r"))) {
- mgmt_log(stderr, "[VMap::lt_readAListFile] Unable to open file: %s, addr list unchanged\n", (const char *)vaddr_path);
+ mgmt_log(stderr, "[VMap::lt_readAListFile] Unable to open file: %s, addr "
+ "list unchanged\n",
+ (const char *)vaddr_path);
return;
}
@@ -327,8 +327,10 @@ VMap::lt_readAListFile(const char *fname)
id_map = ink_hash_table_create(InkHashTableKeyType_String);
while (fgets(buf, 1024, fin)) {
- // since each of the tmp_addr, tmp_interface, tmp_id has length 1024 which is not less than buf
- // so here we don't need to worry about overflow, disable coverity check for this line
+ // since each of the tmp_addr, tmp_interface, tmp_id has length 1024 which
+ // is not less than buf
+ // so here we don't need to worry about overflow, disable coverity check for
+ // this line
// coverity[secure_coding]
if (buf[0] != '#' && isascii(buf[0]) && isdigit(buf[0]) && (sscanf(buf, "%s %s %s\n", tmp_addr, tmp_interface, tmp_id) == 3)) {
tmp_num_addrs++;
@@ -352,8 +354,10 @@ VMap::lt_readAListFile(const char *fname)
InkHashTableValue hash_value;
/* Make sure we have a valid line and its not commented */
- // since each of the tmp_addr, tmp_interface, tmp_id has length 1024 which is not less than buf
- // so here we don't need to worry about overflow, disable coverity check for this line
+ // since each of the tmp_addr, tmp_interface, tmp_id has length 1024 which
+ // is not less than buf
+ // so here we don't need to worry about overflow, disable coverity check for
+ // this line
// coverity[secure_coding]
if (!isascii(buf[0]) || !isdigit(buf[0]) || (sscanf(buf, "%s %s %s\n", tmp_addr, tmp_interface, tmp_id) != 3)) {
continue;
@@ -390,7 +394,6 @@ VMap::lt_readAListFile(const char *fname)
return;
} /* End VMap::lt_readAListFile */
-
/*
* rl_resetSeenFlag(...)
* Function resets the "seen" flag for a given peer's mapped addrs.
@@ -413,7 +416,6 @@ VMap::rl_resetSeenFlag(char *ip)
return;
} /* End VMap::rl_resetSeenFlag */
-
/*
* rl_clearUnSeen(...)
* This function is a sweeper function to clean up the map.
@@ -442,7 +444,6 @@ VMap::rl_clearUnSeen(char *ip)
return numAddrs;
} /* End VMap::rl_clearUnSeen */
-
/*
* rl_remote_map(...)
* Function sends the up interface command to a remote node.
@@ -464,7 +465,6 @@ VMap::rl_remote_map(char *virt_ip, char *real_ip)
return true;
} /* End VMap::rl_remote_map */
-
/*
* rl_remote_unmap(...)
* Function sends the up interface command to a remote node.
@@ -485,7 +485,6 @@ VMap::rl_remote_unmap(char *virt_ip, char *real_ip)
return true;
} /* End VMap::rl_remote_unmap */
-
/*
* rl_map(...)
* Function maps a virt_ip to a real_ip, if real_ip is NULL it maps it
@@ -517,14 +516,15 @@ VMap::rl_map(char *virt_ip, char *real_ip)
*entry = true;
if (!real_ip) {
- mgmt_elog(0, "[VMap::rl_map] no real ip associated with virtual ip %s, mapping to local\n", buf);
+ mgmt_elog(0, "[VMap::rl_map] no real ip associated with virtual ip %s, "
+ "mapping to local\n",
+ buf);
last_map_change = time(NULL);
}
ink_hash_table_insert(tmp, buf, (void *)entry);
return true;
} /* End VMap::rl_map */
-
bool
VMap::rl_unmap(char *virt_ip, char *real_ip)
{
@@ -552,7 +552,6 @@ VMap::rl_unmap(char *virt_ip, char *real_ip)
return true;
} /* End VMap::rl_unmap */
-
/*
* rl_checkConflict(...)
* This function checks for virt conflicts between the local node and
@@ -598,7 +597,6 @@ VMap::rl_checkConflict(char *virt_ip)
return NULL;
} /* End VMap::rl_checkConflict */
-
/*
* checkGlobConflict(...)
* This function checks for conflict in the local map as well as the
@@ -696,7 +694,6 @@ VMap::rl_remap(char *virt_ip, char *cur_ip, char *dest_ip, int cur_naddr, int de
return true;
} /* End VMap::rl_remap */
-
/*
* boundAddr(...)
* Function tests whether or not the addr is bound. Returns 0(not bound),
@@ -724,7 +721,6 @@ VMap::rl_boundAddr(char *virt_ip)
return 0;
} /* End VMap::rl_boundAddr */
-
/*
* boundTo(...)
* Function returns ip addr(string form) of the node that the virt address
@@ -759,7 +755,6 @@ VMap::rl_boundTo(char *virt_ip)
return 0;
} /* End VMap::rl_boundTo */
-
/*
* constructVMapMessage(...)
* Constructs the broadcast message of the local nodes virtual ip map.
@@ -844,7 +839,6 @@ VMap::downAddrs()
return;
} /* End VMap::downAddrs */
-
void
VMap::downOurAddrs()
{
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/cluster/VMap.h
----------------------------------------------------------------------
diff --git a/mgmt/cluster/VMap.h b/mgmt/cluster/VMap.h
index 2959ab8..a270284 100644
--- a/mgmt/cluster/VMap.h
+++ b/mgmt/cluster/VMap.h
@@ -29,19 +29,16 @@
#define MAX_INTERFACE 16
#define MAX_SUB_ID 8
-
typedef struct _vip_info {
char interface[MAX_INTERFACE];
char sub_interface_id[MAX_SUB_ID];
} VIPInfo;
-
typedef struct _realip_info {
struct in_addr real_ip;
bool mappings_for_interface;
} RealIPInfo;
-
/*
* class VMap
* Class implements the protocol and support functions for mapping the
@@ -108,7 +105,8 @@ public:
ink_mutex *mutex;
// Map of virtual ip addresses assigned to the local node
InkHashTable *our_map;
- // Map of virtual ip addresses assigned to other nodes; as indicated through multicast messages; used
+ // Map of virtual ip addresses assigned to other nodes; as indicated through
+ // multicast messages; used
// to detect conflicts
InkHashTable *ext_map;
InkHashTable *id_map;
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/utils/MgmtHashTable.h
----------------------------------------------------------------------
diff --git a/mgmt/utils/MgmtHashTable.h b/mgmt/utils/MgmtHashTable.h
index 1dbc12b..86a946a 100644
--- a/mgmt/utils/MgmtHashTable.h
+++ b/mgmt/utils/MgmtHashTable.h
@@ -189,5 +189,4 @@ private:
}; /* End class MgmtHashTable */
-
#endif /* _MGMT_HASH_TABLE_H */
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/utils/MgmtMarshall.h
----------------------------------------------------------------------
diff --git a/mgmt/utils/MgmtMarshall.h b/mgmt/utils/MgmtMarshall.h
index 7e0f752..ea6784f 100644
--- a/mgmt/utils/MgmtMarshall.h
+++ b/mgmt/utils/MgmtMarshall.h
@@ -31,19 +31,23 @@
// Simple message marshalling.
//
// MGMT_MARSHALL_INT
-// Wire size is 4 bytes signed. This type is used for enum and boolean values, as well as embedded lengths and general
+// Wire size is 4 bytes signed. This type is used for enum and boolean values,
+// as well as embedded lengths and general
// integer values.
//
// MGMT_MARSHALL_LONG
// Wire size is 8 bytes signed.
//
// MGMT_MARSHALL_STRING
-// Wire size is a 4 byte length followed by N bytes. The trailing NUL is always sent and NULL strings are sent as empty
-// strings. This means that the minimum wire size for a string is 5 bytes (4 byte length + NUL byte). The unmarshalled
+// Wire size is a 4 byte length followed by N bytes. The trailing NUL is always
+// sent and NULL strings are sent as empty
+// strings. This means that the minimum wire size for a string is 5 bytes (4
+// byte length + NUL byte). The unmarshalled
// string point is guaranteed to be non-NULL.
//
// MGMT_MARSHALL_DATA
-// Wire size is 4 byte length followed by N data bytes. If the length is 0, no subsequent bytes are sent. In this case
+// Wire size is 4 byte length followed by N data bytes. If the length is 0, no
+// subsequent bytes are sent. In this case
// the unmarshalled data pointer is guaranteed to be NULL.
//
enum MgmtMarshallType {
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/utils/MgmtUtils.cc
----------------------------------------------------------------------
diff --git a/mgmt/utils/MgmtUtils.cc b/mgmt/utils/MgmtUtils.cc
index 0d9bb26..f4d1834 100644
--- a/mgmt/utils/MgmtUtils.cc
+++ b/mgmt/utils/MgmtUtils.cc
@@ -476,7 +476,8 @@ mgmt_getAddrForIntr(char *intrName, sockaddr *addr, int *mtu)
ifc.ifc_buf = ifbuf;
if (ioctl(fakeSocket, SIOCGIFCONF, &ifc) < 0) {
if (errno != EINVAL || lastlen != 0) {
- mgmt_fatal(stderr, errno, "[getAddrForIntr] Unable to read network interface configuration\n");
+ mgmt_fatal(stderr, errno, "[getAddrForIntr] Unable to read network "
+ "interface configuration\n");
}
} else {
if (ifc.ifc_len == lastlen) {
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/mgmt/utils/test_marshall.cc
----------------------------------------------------------------------
diff --git a/mgmt/utils/test_marshall.cc b/mgmt/utils/test_marshall.cc
index 6cc1847..aac7968 100644
--- a/mgmt/utils/test_marshall.cc
+++ b/mgmt/utils/test_marshall.cc
@@ -164,7 +164,8 @@ REGRESSION_TEST(MessageReadWriteA)(RegressionTest *t, int /* atype ATS_UNUSED */
mlong = (MgmtMarshallLong)(&listenfd);
// Check invalid Fd write. ToDo: Commented out, see TS-3052.
- // CHECK_EQ(mgmt_message_write(FD_SETSIZE - 1, ifields, countof(ifields), &mint, &mlong), -1);
+ // CHECK_EQ(mgmt_message_write(FD_SETSIZE - 1, ifields, countof(ifields),
+ // &mint, &mlong), -1);
CHECK_EQ(mgmt_message_write(clientfd, ifields, countof(ifields), &mint, &mlong), 12);
@@ -305,7 +306,8 @@ REGRESSION_TEST(MessageLength)(RegressionTest *t, int /* atype ATS_UNUSED */, in
mstring = (char *)"";
CHECK_EQ(mgmt_message_length(sfields, countof(sfields), &mstring), 4 + 1);
- // data fields include a 4-byte length. We don't go looking at the data in this case.
+ // data fields include a 4-byte length. We don't go looking at the data in
+ // this case.
mdata.len = 99;
mdata.ptr = NULL;
CHECK_EQ(mgmt_message_length(dfields, countof(dfields), &mdata), 99 + 4);
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/proxy/ControlMatcher.cc
----------------------------------------------------------------------
diff --git a/proxy/ControlMatcher.cc b/proxy/ControlMatcher.cc
index b2e0748..0897461 100644
--- a/proxy/ControlMatcher.cc
+++ b/proxy/ControlMatcher.cc
@@ -430,7 +430,8 @@ RegexMatcher<Data, Result>::AllocateSpace(int num_entries)
}
//
-// config_parse_error RegexMatcher<Data,Result>::NewEntry(matcher_line* line_info)
+// config_parse_error RegexMatcher<Data,Result>::NewEntry(matcher_line*
+// line_info)
//
template <class Data, class Result>
config_parse_error
@@ -663,7 +664,8 @@ IpMatcher<Data, Result>::NewEntry(matcher_line *line_info)
}
//
-// void IpMatcherData,Result>::Match(in_addr_t addr, RequestData* rdata, Result* result)
+// void IpMatcherData,Result>::Match(in_addr_t addr, RequestData* rdata, Result*
+// result)
//
template <class Data, class Result>
void
@@ -677,7 +679,6 @@ IpMatcher<Data, Result>::Match(sockaddr const *addr, RequestData *rdata, Result
}
}
-
template <class Data, class Result>
void
IpMatcher<Data, Result>::Print()
@@ -757,7 +758,6 @@ ControlMatcher<Data, Result>::Print()
}
}
-
// void ControlMatcher<Data, Result>::Match(RequestData* rdata
// Result* result)
//
@@ -970,7 +970,6 @@ ControlMatcher<Data, Result>::BuildTable()
return ret;
}
-
/****************************************************************
* TEMPLATE INSTANTIATIONS GO HERE
*
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/proxy/ControlMatcher.h
----------------------------------------------------------------------
diff --git a/proxy/ControlMatcher.h b/proxy/ControlMatcher.h
index 999d09f..ee62c7f 100644
--- a/proxy/ControlMatcher.h
+++ b/proxy/ControlMatcher.h
@@ -36,7 +36,8 @@
* configuration file and builds the lookup table
*
* Four types of matched are supported: hostname, domain name, ip address
- * and URL regex. For these four types, three lookup tables are used. Regex and
+ * and URL regex. For these four types, three lookup tables are used. Regex
+ *and
* ip lookups have there own tables and host and domain lookups share a single
* table
*
@@ -163,7 +164,6 @@ public:
bool internal_txn;
};
-
template <class Data, class Result> class UrlMatcher
{
public:
@@ -196,7 +196,6 @@ protected:
const char *file_name; // Used for Debug/Warning/Error messages
};
-
template <class Data, class Result> class RegexMatcher
{
public:
@@ -301,7 +300,6 @@ public:
const char *file_name; // Used for Debug/Warning/Error messages
};
-
#define ALLOW_HOST_TABLE 1 << 0
#define ALLOW_IP_TABLE 1 << 1
#define ALLOW_REGEX_TABLE 1 << 2
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/1c06db83/proxy/CoreUtils.cc
----------------------------------------------------------------------
diff --git a/proxy/CoreUtils.cc b/proxy/CoreUtils.cc
index 32c3bff..120dba0 100644
--- a/proxy/CoreUtils.cc
+++ b/proxy/CoreUtils.cc
@@ -28,7 +28,6 @@
Description: Automated processing of core files on Linux
****************************************************************************/
-
/*
Stack Unwinding procedure on ix86 architecture on Linux :
Get the first frame pointer in $ebp.
@@ -77,8 +76,10 @@
* +-----------------+ +-----------------+
*/
-/* 32-bit arguments are pushed down stack in reverse syntactic order (hence accessed/popped in the right order), above the 32-bit
- * near return address. %ebp, %esi, %edi, %ebx are callee-saved, other registers are caller-saved; %eax is to hold the result, or
+/* 32-bit arguments are pushed down stack in reverse syntactic order (hence
+ * accessed/popped in the right order), above the 32-bit
+ * near return address. %ebp, %esi, %edi, %ebx are callee-saved, other registers
+ * are caller-saved; %eax is to hold the result, or
* %edx:%eax for 64-bit results */
/* has -fomit-frame-pointer has any repercussions??
@@ -128,7 +129,6 @@ char netvc_ptr_str[256] = "";
HdrHeap *swizzle_heap;
char *ptr_data;
-
// returns the index of the vaddr or the index after where it should be
intptr_t
CoreUtils::find_vaddr(intptr_t vaddr, intptr_t upper, intptr_t lower)
@@ -208,7 +208,6 @@ CoreUtils::insert_table(intptr_t vaddr1, intptr_t offset1, intptr_t fsize1)
}
}
-
// returns -1 on failure otherwise fills the buffer and
// returns the number of bytes read
intptr_t
@@ -244,7 +243,6 @@ CoreUtils::read_from_core(intptr_t vaddr, intptr_t bytes, char *buf)
return -1;
}
-
/* Linux Specific functions */
#if defined(linux)
@@ -362,7 +360,6 @@ CoreUtils::find_stuff(StuffTest_f f)
}
#endif // linux check
-
// test whether a given register is an HttpSM
// if it is, call process_HttpSM on it
void
@@ -477,7 +474,6 @@ CoreUtils::process_HttpSM(HttpSM *core_ptr)
printf("process_HttpSM : last_seen_http_sm == core_ptr\n");
}
-
void
CoreUtils::print_http_hdr(HTTPHdr *h, const char *name)
{
@@ -792,7 +788,6 @@ CoreUtils::process_NetVC(UnixNetVConnection *nvc_test)
ats_free(buf);
}
-
char *
CoreUtils::load_string(const char *addr)
{