You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2016/11/10 02:14:46 UTC
[trafficserver] 02/02: TS-4728: Remove invalid LogHost assertion.
This is an automated email from the ASF dual-hosted git repository.
sorber pushed a commit to branch 6.2.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git
commit 81ed47b0f68bba00ede2d2ac9f962e31e7bf7cb7
Author: James Peach <jp...@apache.org>
AuthorDate: Wed Aug 10 14:16:16 2016 -0700
TS-4728: Remove invalid LogHost assertion.
(cherry picked from commit f502718abc09c66830d9dececf596e039daec422)
Conflicts:
proxy/logging/LogHost.cc
---
proxy/logging/LogHost.cc | 41 ++++++++++++++++++++---------------------
proxy/logging/LogHost.h | 13 +++++++++++--
2 files changed, 31 insertions(+), 23 deletions(-)
diff --git a/proxy/logging/LogHost.cc b/proxy/logging/LogHost.cc
index a887721..8876ef2 100644
--- a/proxy/logging/LogHost.cc
+++ b/proxy/logging/LogHost.cc
@@ -46,6 +46,25 @@
#define PING true
#define NOPING false
+static Ptr<LogFile>
+make_orphan_logfile(LogHost *lh, const char *filename)
+{
+ const char *ext = "orphan";
+ unsigned name_len = (unsigned)(strlen(filename) + strlen(lh->name()) + strlen(ext) + 16);
+ char *name_buf = (char *)ats_malloc(name_len);
+
+ // NT: replace ':'s with '-'s. This change is necessary because
+ // NT doesn't like filenames with ':'s in them. ^_^
+ snprintf(name_buf, name_len, "%s%s%s-%u.%s", filename, LOGFILE_SEPARATOR_STRING, lh->name(), lh->port(), ext);
+
+ // XXX should check for conflicts with orphan filename
+
+ Ptr<LogFile> orphan(new LogFile(name_buf, NULL, LOG_FILE_ASCII, lh->signature()));
+
+ ats_free(name_buf);
+ return orphan;
+}
+
/*-------------------------------------------------------------------------
LogHost
-------------------------------------------------------------------------*/
@@ -78,7 +97,7 @@ LogHost::LogHost(const LogHost &rhs)
m_log_collation_client_sm(NULL)
{
memcpy(m_ipstr, rhs.m_ipstr, sizeof(m_ipstr));
- create_orphan_LogFile_object();
+ m_orphan_file = make_orphan_logfile(this, m_object_filename);
}
LogHost::~LogHost()
@@ -226,26 +245,6 @@ LogHost::disconnect()
m_connected = false;
}
-void
-LogHost::create_orphan_LogFile_object()
-{
- delete m_orphan_file;
-
- const char *orphan_ext = "orphan";
- unsigned name_len = (unsigned)(strlen(m_object_filename) + strlen(name()) + strlen(orphan_ext) + 16);
- char *name_buf = (char *)ats_malloc(name_len);
-
- // NT: replace ':'s with '-'s. This change is necessary because
- // NT doesn't like filenames with ':'s in them. ^_^
- snprintf(name_buf, name_len, "%s%s%s-%u.%s", m_object_filename, LOGFILE_SEPARATOR_STRING, name(), port(), orphan_ext);
-
- // should check for conflicts with orphan filename
- //
- m_orphan_file = new LogFile(name_buf, NULL, LOG_FILE_ASCII, m_object_signature);
- ink_assert(m_orphan_file != NULL);
- ats_free(name_buf);
-}
-
//
// preprocess the given buffer data before sent to target host
// and try to delete it when its reference become zero.
diff --git a/proxy/logging/LogHost.h b/proxy/logging/LogHost.h
index 5eb0d91..11842c8 100644
--- a/proxy/logging/LogHost.h
+++ b/proxy/logging/LogHost.h
@@ -61,21 +61,30 @@ public:
//
void orphan_write_and_try_delete(LogBuffer *lb);
- char const *
+ const char *
name() const
{
return m_name ? m_name : "UNKNOWN";
}
+
+ uint64_t
+ signature() const
+ {
+ return m_object_signature;
+ }
+
IpAddr const &
ip_addr() const
{
return m_ip;
}
+
in_port_t
port() const
{
return m_port;
}
+
char const *
ipstr() const
{
@@ -99,7 +108,6 @@ public:
private:
void clear();
bool authenticated();
- void create_orphan_LogFile_object();
private:
char *m_object_filename;
@@ -143,6 +151,7 @@ public:
{
return m_host_list.head;
}
+
LogHost *
next(LogHost *here)
{
--
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>.