You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ig...@apache.org on 2011/07/12 17:35:36 UTC
svn commit: r1145634 - in /trafficserver/traffic/branches/3.0.x: ./
iocore/dns/ iocore/net/ lib/records/ proxy/ proxy/logging/
Author: igalic
Date: Tue Jul 12 15:35:36 2011
New Revision: 1145634
URL: http://svn.apache.org/viewvc?rev=1145634&view=rev
Log:
backport TS-828
Modified:
trafficserver/traffic/branches/3.0.x/ (props changed)
trafficserver/traffic/branches/3.0.x/CHANGES
trafficserver/traffic/branches/3.0.x/STATUS
trafficserver/traffic/branches/3.0.x/iocore/dns/SplitDNS.cc
trafficserver/traffic/branches/3.0.x/iocore/net/I_NetVConnection.h
trafficserver/traffic/branches/3.0.x/lib/records/I_RecCore.h
trafficserver/traffic/branches/3.0.x/lib/records/P_RecCore.i
trafficserver/traffic/branches/3.0.x/lib/records/RecCore.cc
trafficserver/traffic/branches/3.0.x/lib/records/RecLocal.cc
trafficserver/traffic/branches/3.0.x/lib/records/RecMessage.cc
trafficserver/traffic/branches/3.0.x/lib/records/RecProcess.cc
trafficserver/traffic/branches/3.0.x/proxy/Main.cc
trafficserver/traffic/branches/3.0.x/proxy/logging/LogConfig.cc
trafficserver/traffic/branches/3.0.x/proxy/logging/LogConfigCollation.cc
trafficserver/traffic/branches/3.0.x/proxy/logging/LogFormat.cc
trafficserver/traffic/branches/3.0.x/proxy/logging/LogObject.cc
trafficserver/traffic/branches/3.0.x/proxy/logging/LogObject.h
Propchange: trafficserver/traffic/branches/3.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 12 15:35:36 2011
@@ -1,4 +1,4 @@
/incubator/trafficserver/traffic/branches/dev:891823-915885
/trafficserver/traffic/branches/ts-291:965529-991993
/trafficserver/traffic/branches/wccp:1021790-1040544
-/trafficserver/traffic/trunk:1129268,1131080,1131473,1133066,1133071,1135769-1135770,1137111,1137844,1137846
+/trafficserver/traffic/trunk:1129268,1131080,1131473,1133066,1133071,1133639,1135769-1135770,1137111,1137844,1137846
Modified: trafficserver/traffic/branches/3.0.x/CHANGES
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/CHANGES?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/CHANGES (original)
+++ trafficserver/traffic/branches/3.0.x/CHANGES Tue Jul 12 15:35:36 2011
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 3.0.1
+ *) [TS-828]: Various memory leaks and uninitialized values.
+ Author: William Bardwell
+
*) [TS-839] Build problems when specifying lmza location.
*) [TS-840] Regression checks fail (again) due to faulty assert use.
Modified: trafficserver/traffic/branches/3.0.x/STATUS
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/STATUS?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/STATUS (original)
+++ trafficserver/traffic/branches/3.0.x/STATUS Tue Jul 12 15:35:36 2011
@@ -40,11 +40,6 @@ A list of all bugs open for the next v3.
PATCHES PROPOSED TO BACKPORT FROM TRUNK:
[ New proposals should be added at the end of the list ]
- * core: Various memory leaks and uninitialized values.
- Trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1133639
- Jira: https://issues.apache.org/jira/browse/TS-828
- +1: zwoop, zym, igalic
-
* build: remove uninstall target from build system
Trunk patch: http://svn.apache.org/viewvc?rev=1136958&view=rev
Jira: https://issues.apache.org/jira/browse/TS-842
Modified: trafficserver/traffic/branches/3.0.x/iocore/dns/SplitDNS.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/iocore/dns/SplitDNS.cc?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/iocore/dns/SplitDNS.cc (original)
+++ trafficserver/traffic/branches/3.0.x/iocore/dns/SplitDNS.cc Tue Jul 12 15:35:36 2011
@@ -148,19 +148,19 @@ SplitDNSConfig::startup()
void
SplitDNSConfig::reconfigure()
{
- SplitDNS *params = NEW(new SplitDNS);
-
- params->m_SplitDNSlEnable = gsplit_dns_enabled;
-
if (0 == gsplit_dns_enabled)
return;
+ SplitDNS *params = NEW(new SplitDNS);
+
+ params->m_SplitDNSlEnable = gsplit_dns_enabled;
params->m_DNSSrvrTable = NEW(new DNS_table("proxy.config.dns.splitdns.filename", modulePrefix, &sdns_dest_tags));
params->m_numEle = params->m_DNSSrvrTable->getEntryCount();
if (0 == params->m_DNSSrvrTable || (0 == params->m_numEle)) {
Warning("No NAMEDs provided! Disabling SplitDNS");
gsplit_dns_enabled = 0;
+ delete params;
return;
}
Modified: trafficserver/traffic/branches/3.0.x/iocore/net/I_NetVConnection.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/iocore/net/I_NetVConnection.h?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/iocore/net/I_NetVConnection.h (original)
+++ trafficserver/traffic/branches/3.0.x/iocore/net/I_NetVConnection.h Tue Jul 12 15:35:36 2011
@@ -482,6 +482,7 @@ NetVConnection::NetVConnection():
got_local_addr(0),
got_remote_addr(0),
is_internal_request(false),
+ is_transparent(false),
is_other_side_transparent(false)
{
memset(&local_addr, 0, sizeof(local_addr));
Modified: trafficserver/traffic/branches/3.0.x/lib/records/I_RecCore.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/lib/records/I_RecCore.h?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/lib/records/I_RecCore.h (original)
+++ trafficserver/traffic/branches/3.0.x/lib/records/I_RecCore.h Tue Jul 12 15:35:36 2011
@@ -181,8 +181,16 @@ void RecSignalManager(int, const char *)
_var = (int32_t)REC_ConfigReadInteger(_config_var_name); \
} while (0)
+/*
+ * RecLinkConfigString allocates the RecString and stores the ptr to it (&var).
+ * So before changing _var (the RecString) we have to free the original one.
+ * Really, we somehow need to know whether RecLinkConfigString allocated _var.
+ * For now, we're using the return value to indicate this, even though it's
+ * not always the case. If we're wrong, we'll leak the RecString.
+ */
#define REC_EstablishStaticConfigStringAlloc(_var, _config_var_name) do { \
- RecLinkConfigString(_config_var_name, &_var); \
+ if (RecLinkConfigString(_config_var_name, &_var) == REC_ERR_OKAY) \
+ xfree(_var); \
_var = (RecString)REC_ConfigReadString(_config_var_name); \
} while (0)
Modified: trafficserver/traffic/branches/3.0.x/lib/records/P_RecCore.i
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/lib/records/P_RecCore.i?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/lib/records/P_RecCore.i (original)
+++ trafficserver/traffic/branches/3.0.x/lib/records/P_RecCore.i Tue Jul 12 15:35:36 2011
@@ -572,6 +572,9 @@ RecReadStatsFile()
ink_rwlock_unlock(&g_records_rwlock);
+ if (m)
+ xfree(m);
+
return REC_ERR_OKAY;
}
Modified: trafficserver/traffic/branches/3.0.x/lib/records/RecCore.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/lib/records/RecCore.cc?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/lib/records/RecCore.cc (original)
+++ trafficserver/traffic/branches/3.0.x/lib/records/RecCore.cc Tue Jul 12 15:35:36 2011
@@ -224,6 +224,7 @@ RecCoreInit(RecModeT mode_type, Diags *_
bool file_exists = true;
g_rec_config_fpath = Layout::relative_to(Layout::get()->sysconfdir, REC_CONFIG_FILE REC_SHADOW_EXT);
if (RecFileExists(g_rec_config_fpath) == REC_ERR_FAIL) {
+ xfree((char *)g_rec_config_fpath);
g_rec_config_fpath = Layout::relative_to(Layout::get()->sysconfdir, REC_CONFIG_FILE);
if (RecFileExists(g_rec_config_fpath) == REC_ERR_FAIL) {
RecLog(DL_Warning, "Could not find '%s', system will run with defaults\n", REC_CONFIG_FILE);
@@ -345,6 +346,7 @@ RecRegisterConfigUpdateCb(const char *na
memset(new_callback, 0, sizeof(RecConfigUpdateCbList));
new_callback->update_cb = update_cb;
new_callback->update_cookie = cookie;
+
new_callback->next = NULL;
ink_debug_assert(new_callback);
Modified: trafficserver/traffic/branches/3.0.x/lib/records/RecLocal.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/lib/records/RecLocal.cc?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/lib/records/RecLocal.cc (original)
+++ trafficserver/traffic/branches/3.0.x/lib/records/RecLocal.cc Tue Jul 12 15:35:36 2011
@@ -139,7 +139,6 @@ RecLocalInit(Diags * _diags)
return REC_ERR_OKAY;
}
- g_records_tree = new RecTree(NULL);
g_mode_type = RECM_SERVER;
if (RecCoreInit(RECM_SERVER, _diags) == REC_ERR_FAIL) {
Modified: trafficserver/traffic/branches/3.0.x/lib/records/RecMessage.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/lib/records/RecMessage.cc?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/lib/records/RecMessage.cc (original)
+++ trafficserver/traffic/branches/3.0.x/lib/records/RecMessage.cc Tue Jul 12 15:35:36 2011
@@ -238,7 +238,6 @@ RecMessageInit(RecModeT mode_type)
int
RecMessageSend(RecMessage * msg)
{
-
int msg_size;
// Make a copy of the record, but truncate it to the size actually used
@@ -253,7 +252,6 @@ RecMessageSend(RecMessage * msg)
}
return REC_ERR_OKAY;
-
}
//-------------------------------------------------------------------------
@@ -262,21 +260,16 @@ RecMessageSend(RecMessage * msg)
//
//-------------------------------------------------------------------------
#elif defined (REC_BUILD_STUB)
-
#else
-
#error "Required #define not specificed; expected REC_BUILD_STAND_ALONE, REC_BUILD_MGMT, or REC_BUILD_STUB"
-
#endif
//-------------------------------------------------------------------------
// RecMessageAlloc
//-------------------------------------------------------------------------
-
RecMessage *
RecMessageAlloc(RecMessageT msg_type, int initial_size)
{
-
RecMessage *msg;
msg = (RecMessage *) xmalloc(sizeof(RecMessageHdr) + initial_size);
@@ -288,7 +281,6 @@ RecMessageAlloc(RecMessageT msg_type, in
msg->entries = 0;
return msg;
-
}
//-------------------------------------------------------------------------
@@ -308,7 +300,6 @@ RecMessageFree(RecMessage * msg)
RecMessage *
RecMessageMarshal_Realloc(RecMessage * msg, const RecRecord * record)
{
-
int msg_ele_size;
int rec_name_len = -1;
int rec_data_str_len = -1;
@@ -392,7 +383,6 @@ RecMessageMarshal_Realloc(RecMessage * m
msg->entries += 1;
return msg;
-
}
//-------------------------------------------------------------------------
@@ -402,12 +392,10 @@ RecMessageMarshal_Realloc(RecMessage * m
int
RecMessageUnmarshalFirst(RecMessage * msg, RecMessageItr * itr, RecRecord ** record)
{
-
itr->ele_hdr = (RecMessageEleHdr *) ((char *) msg + msg->o_start);
itr->next = 1;
return RecMessageUnmarshalNext(msg, NULL, record);
-
}
//-------------------------------------------------------------------------
@@ -417,7 +405,6 @@ RecMessageUnmarshalFirst(RecMessage * ms
int
RecMessageUnmarshalNext(RecMessage * msg, RecMessageItr * itr, RecRecord ** record)
{
-
RecMessageEleHdr *eh;
RecRecord *r;
@@ -464,7 +451,6 @@ RecMessageUnmarshalNext(RecMessage * msg
*record = r;
return REC_ERR_OKAY;
-
}
//-------------------------------------------------------------------------
@@ -474,7 +460,6 @@ RecMessageUnmarshalNext(RecMessage * msg
int
RecMessageRegisterRecvCb(RecMessageRecvCb recv_cb, void *cookie)
{
-
if (g_recv_cb) {
return REC_ERR_FAIL;
}
@@ -482,7 +467,6 @@ RecMessageRegisterRecvCb(RecMessageRecvC
g_recv_cb = recv_cb;
return REC_ERR_OKAY;
-
}
//-------------------------------------------------------------------------
@@ -506,7 +490,6 @@ RecMessageRecvThis(void *cookie, char *d
RecMessage *
RecMessageReadFromDisk(const char *fpath)
{
-
RecMessageHdr msg_hdr;
RecMessage *msg = NULL;
RecHandle h_file;
@@ -539,7 +522,6 @@ Ldone:
}
return msg;
-
}
//-------------------------------------------------------------------------
@@ -549,7 +531,6 @@ Ldone:
int
RecMessageWriteToDisk(RecMessage *msg, const char *fpath)
{
-
int msg_size;
RecHandle h_file;
int bytes_written;
@@ -568,7 +549,6 @@ RecMessageWriteToDisk(RecMessage *msg, c
}
return REC_ERR_OKAY;
-
}
//
Modified: trafficserver/traffic/branches/3.0.x/lib/records/RecProcess.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/lib/records/RecProcess.cc?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/lib/records/RecProcess.cc (original)
+++ trafficserver/traffic/branches/3.0.x/lib/records/RecProcess.cc Tue Jul 12 15:35:36 2011
@@ -287,7 +287,6 @@ RecProcessInit(RecModeT mode_type, Diags
return REC_ERR_OKAY;
}
- g_records_tree = new RecTree(NULL);
g_mode_type = mode_type;
if (RecCoreInit(mode_type, _diags) == REC_ERR_FAIL) {
Modified: trafficserver/traffic/branches/3.0.x/proxy/Main.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/proxy/Main.cc?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/proxy/Main.cc (original)
+++ trafficserver/traffic/branches/3.0.x/proxy/Main.cc Tue Jul 12 15:35:36 2011
@@ -1251,6 +1251,7 @@ syslog_log_configure()
}
// TODO: Not really, what's up with this?
Debug("server", "Setting syslog facility to %d\n", syslog_facility);
+ xfree(facility_str);
}
// void syslog_thr_init()
Modified: trafficserver/traffic/branches/3.0.x/proxy/logging/LogConfig.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/proxy/logging/LogConfig.cc?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/proxy/logging/LogConfig.cc (original)
+++ trafficserver/traffic/branches/3.0.x/proxy/logging/LogConfig.cc Tue Jul 12 15:35:36 2011
@@ -813,7 +813,6 @@ LogConfig::setup_pre_defined_info(PreDef
global_format_list.add(fmt, false);
Debug("log", "squid format added to the global format list");
-
if (squid_log_enabled) {
pdfi = NEW(new PreDefinedFormatInfo(fmt, squid_log_name, squid_log_is_ascii, squid_log_header));
preDefInfoList->enqueue(pdfi);
@@ -956,9 +955,7 @@ LogConfig::split_by_protocol(const PreDe
size_t
LogConfig::split_by_hostname(const PreDefinedFormatInfoList & pre_def_info_list, LogFilter * reject_protocol_filter)
{
-
size_t n_hosts;
-
char **host = read_log_hosts_file(&n_hosts); // allocates memory for array
if (n_hosts) {
@@ -1106,6 +1103,12 @@ LogConfig::setup_log_objects()
if (is_debug_tag_set("log")) {
log_object_manager.display();
}
+
+ PreDefinedFormatInfo *pdfi;
+ while (!pre_def_info_list.empty()) {
+ pdfi = pre_def_info_list.pop();
+ delete pdfi;
+ }
}
/*-------------------------------------------------------------------------
Modified: trafficserver/traffic/branches/3.0.x/proxy/logging/LogConfigCollation.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/proxy/logging/LogConfigCollation.cc?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/proxy/logging/LogConfigCollation.cc (original)
+++ trafficserver/traffic/branches/3.0.x/proxy/logging/LogConfigCollation.cc Tue Jul 12 15:35:36 2011
@@ -54,8 +54,8 @@ LogConfig::create_pre_defined_objects_wi
LogFilter ** filter, const char *filt_name, bool force_extension)
{
PreDefinedFormatInfo *pdi;
- for (pdi = pre_def_info_list.head; pdi != NULL; pdi = (pdi->link).next) {
+ for (pdi = pre_def_info_list.head; pdi != NULL; pdi = (pdi->link).next) {
char *obj_fname;
char obj_filt_fname[PATH_MAX];
if (filt_name) {
Modified: trafficserver/traffic/branches/3.0.x/proxy/logging/LogFormat.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/proxy/logging/LogFormat.cc?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/proxy/logging/LogFormat.cc (original)
+++ trafficserver/traffic/branches/3.0.x/proxy/logging/LogFormat.cc Tue Jul 12 15:35:36 2011
@@ -195,18 +195,18 @@ LogFormat::init_variables(const char *na
-------------------------------------------------------------------------*/
LogFormat::LogFormat(LogFormatType type)
-:m_interval_sec(0)
- , m_interval_next(0)
- , m_agg_marshal_space(NULL)
- , m_valid(false)
- , m_name_str(NULL)
- , m_name_id(0)
- , m_fieldlist_str(NULL)
- , m_fieldlist_id(0)
- , m_field_count(0)
- , m_printf_str(NULL)
- , m_aggregate(false)
- , m_format_str(NULL)
+ : m_interval_sec(0),
+ m_interval_next(0),
+ m_agg_marshal_space(NULL),
+ m_valid(false),
+ m_name_str(NULL),
+ m_name_id(0),
+ m_fieldlist_str(NULL),
+ m_fieldlist_id(0),
+ m_field_count(0),
+ m_printf_str(NULL),
+ m_aggregate(false),
+ m_format_str(NULL)
{
switch (type) {
case SQUID_LOG:
@@ -246,30 +246,18 @@ LogFormat::LogFormat(LogFormatType type)
-------------------------------------------------------------------------*/
LogFormat::LogFormat(const char *name, const char *format_str, unsigned interval_sec)
- :
-m_interval_sec(0)
- ,
-m_interval_next(0)
- ,
-m_agg_marshal_space(NULL)
- ,
-m_valid(false)
- ,
-m_name_str(NULL)
- ,
-m_name_id(0)
- ,
-m_fieldlist_str(NULL)
- ,
-m_fieldlist_id(0)
- ,
-m_field_count(0)
- ,
-m_printf_str(NULL)
- ,
-m_aggregate(false)
- ,
-m_format_str(NULL)
+ : m_interval_sec(0),
+ m_interval_next(0),
+ m_agg_marshal_space(NULL),
+ m_valid(false),
+ m_name_str(NULL),
+ m_name_id(0),
+ m_fieldlist_str(NULL),
+ m_fieldlist_id(0),
+ m_field_count(0),
+ m_printf_str(NULL),
+ m_aggregate(false),
+ m_format_str(NULL)
{
setup(name, format_str, interval_sec);
m_format_type = CUSTOM_LOG;
@@ -284,30 +272,18 @@ m_format_str(NULL)
// delete this.
//
LogFormat::LogFormat(const char *name, const char *fieldlist_str, const char *printf_str, unsigned interval_sec)
- :
-m_interval_sec(0)
- ,
-m_interval_next(0)
- ,
-m_agg_marshal_space(NULL)
- ,
-m_valid(false)
- ,
-m_name_str(NULL)
- ,
-m_name_id(0)
- ,
-m_fieldlist_str(NULL)
- ,
-m_fieldlist_id(0)
- ,
-m_field_count(0)
- ,
-m_printf_str(NULL)
- ,
-m_aggregate(false)
- ,
-m_format_str(NULL)
+ : m_interval_sec(0),
+ m_interval_next(0),
+ m_agg_marshal_space(NULL),
+ m_valid(false),
+ m_name_str(NULL),
+ m_name_id(0),
+ m_fieldlist_str(NULL),
+ m_fieldlist_id(0),
+ m_field_count(0),
+ m_printf_str(NULL),
+ m_aggregate(false),
+ m_format_str(NULL)
{
init_variables(name, fieldlist_str, printf_str, interval_sec);
m_format_type = CUSTOM_LOG;
@@ -320,32 +296,19 @@ m_format_str(NULL)
-------------------------------------------------------------------------*/
LogFormat::LogFormat(const LogFormat & rhs)
- :
-m_interval_sec(0)
- ,
-m_interval_next(0)
- ,
-m_agg_marshal_space(NULL)
- ,
-m_valid(rhs.m_valid)
- ,
-m_name_str(NULL)
- ,
-m_name_id(0)
- ,
-m_fieldlist_str(NULL)
- ,
-m_fieldlist_id(0)
- ,
-m_field_count(0)
- ,
-m_printf_str(NULL)
- ,
-m_aggregate(false)
- ,
-m_format_str(NULL)
- ,
-m_format_type(rhs.m_format_type)
+ : m_interval_sec(0),
+ m_interval_next(0),
+ m_agg_marshal_space(NULL),
+ m_valid(rhs.m_valid),
+ m_name_str(NULL),
+ m_name_id(0),
+ m_fieldlist_str(NULL),
+ m_fieldlist_id(0),
+ m_field_count(0),
+ m_printf_str(NULL),
+ m_aggregate(false),
+ m_format_str(NULL),
+ m_format_type(rhs.m_format_type)
{
if (m_valid) {
if (m_format_type == TEXT_LOG) {
Modified: trafficserver/traffic/branches/3.0.x/proxy/logging/LogObject.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/proxy/logging/LogObject.cc?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/proxy/logging/LogObject.cc (original)
+++ trafficserver/traffic/branches/3.0.x/proxy/logging/LogObject.cc Tue Jul 12 15:35:36 2011
@@ -83,11 +83,35 @@ LogObject::LogObject(LogFormat * format,
const char *basename, LogFileFormat file_format,
const char *header, int rolling_enabled,
int rolling_interval_sec, int rolling_offset_hr, int rolling_size_mb)
-:m_alt_filename(NULL)
- , m_flags(0)
- , m_signature(0)
- , m_ref_count(0)
- , m_log_buffer(NULL)
+ : m_alt_filename(NULL),
+ m_flags(0),
+ m_signature(0),
+ m_ref_count(0),
+ m_log_buffer(NULL)
+{
+ init(format, log_dir, basename, file_format, header, rolling_enabled, rolling_interval_sec,
+ rolling_offset_hr, rolling_size_mb);
+}
+
+LogObject::LogObject(LogFormat format, const char *log_dir,
+ const char *basename, LogFileFormat file_format,
+ const char *header, int rolling_enabled,
+ int rolling_interval_sec, int rolling_offset_hr, int rolling_size_mb)
+ : m_alt_filename(NULL),
+ m_flags(0),
+ m_signature(0),
+ m_ref_count(0),
+ m_log_buffer(NULL)
+{
+ init(&format, log_dir, basename, file_format, header, rolling_enabled, rolling_interval_sec,
+ rolling_offset_hr, rolling_size_mb);
+}
+
+void
+LogObject::init(LogFormat * format, const char *log_dir,
+ const char *basename, LogFileFormat file_format,
+ const char *header, int rolling_enabled,
+ int rolling_interval_sec, int rolling_offset_hr, int rolling_size_mb)
{
LogBuffer *tmp_lb_array[(DELAY_DELETE_SIZE + (DELAY_DELETE_SIZE / 4))];
int i;
@@ -737,11 +761,10 @@ LogObject::do_filesystem_checks()
/*-------------------------------------------------------------------------
TextLogObject::TextLogObject
-------------------------------------------------------------------------*/
-
-TextLogObject::TextLogObject(const char *name, const char *log_dir, bool timestamps, const char *header, int rolling_enabled, int rolling_interval_sec, int rolling_offset_hr, int rolling_size_mb):
-
-LogObject(NEW(new LogFormat(TEXT_LOG)), log_dir, name, ASCII_LOG, header,
- rolling_enabled, rolling_interval_sec, rolling_offset_hr, rolling_size_mb), m_timestamps(timestamps)
+TextLogObject::TextLogObject(const char *name, const char *log_dir, bool timestamps, const char *header, int rolling_enabled,
+ int rolling_interval_sec, int rolling_offset_hr, int rolling_size_mb)
+ : LogObject(LogFormat(TEXT_LOG), log_dir, name, ASCII_LOG, header,
+ rolling_enabled, rolling_interval_sec, rolling_offset_hr, rolling_size_mb), m_timestamps(timestamps)
{
}
Modified: trafficserver/traffic/branches/3.0.x/proxy/logging/LogObject.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/branches/3.0.x/proxy/logging/LogObject.h?rev=1145634&r1=1145633&r2=1145634&view=diff
==============================================================================
--- trafficserver/traffic/branches/3.0.x/proxy/logging/LogObject.h (original)
+++ trafficserver/traffic/branches/3.0.x/proxy/logging/LogObject.h Tue Jul 12 15:35:36 2011
@@ -127,10 +127,16 @@ public:
// it should not be destroyed during a reconfiguration
// WRITES_TO_PIPE: object writes to a named pipe rather than to a file
- LogObject(LogFormat * format, const char *log_dir, const char *basename,
+ LogObject(LogFormat *format, const char *log_dir, const char *basename,
+ LogFileFormat file_format, const char *header,
+ int rolling_enabled, int rolling_interval_sec = 0, int rolling_offset_hr = 0, int rolling_size_mb = 0);
+ LogObject(LogFormat format, const char *log_dir, const char *basename,
LogFileFormat file_format, const char *header,
int rolling_enabled, int rolling_interval_sec = 0, int rolling_offset_hr = 0, int rolling_size_mb = 0);
private:
+ void init(LogFormat * format, const char *log_dir, const char *basename,
+ LogFileFormat file_format, const char *header,
+ int rolling_enabled, int rolling_interval_sec = 0, int rolling_offset_hr = 0, int rolling_size_mb = 0);
LogObject(LogObject &);
public: