summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Mesnier <mesnier_p@ociweb.com>2013-04-02 23:15:10 +0000
committerPhil Mesnier <mesnier_p@ociweb.com>2013-04-02 23:15:10 +0000
commitc4e590939ffb7a94a0f382ffd8b0f77a47cceda1 (patch)
tree26ce0e1db255b9db447846c63977c1b61e2bef88
parent4104cb939aa6bcd5b2560a87d9b2a0a84914dcda (diff)
downloadATCD-c4e590939ffb7a94a0f382ffd8b0f77a47cceda1.tar.gz
Tue Apr 2 23:13:50 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com>
-rw-r--r--TAO/ChangeLog_Asynch_ImR21
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp60
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/Forwarder.cpp13
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/INS_Locator.cpp4
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp26
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp93
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/LiveCheck.h1
-rw-r--r--TAO/utils/logWalker/HostProcess.cpp41
-rw-r--r--TAO/utils/logWalker/HostProcess.h12
-rw-r--r--TAO/utils/logWalker/Log.cpp10
-rw-r--r--TAO/utils/logWalker/PeerProcess.cpp136
-rw-r--r--TAO/utils/logWalker/PeerProcess.h41
-rw-r--r--TAO/utils/logWalker/Session.cpp41
-rw-r--r--TAO/utils/logWalker/Session.h13
14 files changed, 287 insertions, 225 deletions
diff --git a/TAO/ChangeLog_Asynch_ImR b/TAO/ChangeLog_Asynch_ImR
index f946db81daa..e72a34f37ed 100644
--- a/TAO/ChangeLog_Asynch_ImR
+++ b/TAO/ChangeLog_Asynch_ImR
@@ -1,3 +1,24 @@
+Tue Apr 2 23:13:50 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com>
+
+ * orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp:
+ * orbsvcs/ImplRepo_Service/Forwarder.cpp:
+ * orbsvcs/ImplRepo_Service/INS_Locator.cpp:
+ * orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp:
+ * orbsvcs/ImplRepo_Service/LiveCheck.h:
+ * orbsvcs/ImplRepo_Service/LiveCheck.cpp:
+
+ Clean up debugging output and improve ping retry logic.
+
+ * utils/logWalker/HostProcess.h:
+ * utils/logWalker/HostProcess.cpp:
+ * utils/logWalker/Log.cpp:
+ * utils/logWalker/PeerProcess.h:
+ * utils/logWalker/PeerProcess.cpp:
+ * utils/logWalker/Session.h:
+ * utils/logWalker/Session.cpp:
+
+ Fix up the endpoint association so multiple log files can correlate.
+
Tue Apr 2 13:17:44 UTC 2013 Phil Mesnier <mesnier_p@ociweb.com>
* orbsvcs/ImplRepo_Service/Forwarder.cpp:
diff --git a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp
index 1b154a9b523..db60df4d9fb 100644
--- a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp
@@ -20,15 +20,11 @@ AsyncAccessManager::AsyncAccessManager (const Server_Info &info,
refcount_(1),
lock_()
{
- ACE_DEBUG ((LM_DEBUG,"AAM(%x), ctor, name = %s\n",
- this, info.name.c_str()));
this->info_ = new Server_Info (info);
}
AsyncAccessManager::~AsyncAccessManager (void)
{
- ACE_DEBUG ((LM_DEBUG, "AAM (%x): dtor, name = %s\n", this,
- info_->name.c_str()));
delete this->info_;
}
@@ -42,8 +38,6 @@ bool
AsyncAccessManager::has_server (const char *s)
{
int result = ACE_OS::strcmp (this->info_->name.c_str(),s);
- ACE_DEBUG ((LM_DEBUG, "AAM (%x): has_server test, my name = %s, s = %s result = %d\n",
- this, info_->name.c_str(), s, result));
return result == 0;
}
@@ -54,13 +48,6 @@ AsyncAccessManager::add_interest (ImR_ResponseHandler *rh)
ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
this->rh_list_.push_back (rh);
}
- if (this->locator_.debug() > 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) AsyncAccessManager::add_interest: ")
- ACE_TEXT ("server = <%C>, status = %d count = %d\n"),
- this->info_->name.c_str(), this->status_, this->rh_list_.size()));
- }
if (this->status_ == AAM_SERVER_READY || this->status_ == AAM_SERVER_STARTED_RUNNING)
{
@@ -68,10 +55,6 @@ AsyncAccessManager::add_interest (ImR_ResponseHandler *rh)
{
this->status_ = AAM_SERVER_READY;
this->final_state();
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) AsyncAccessManager::add_interest: ")
- ACE_TEXT ("server = <%C>, server is alive\n"),
- this->info_->name.c_str()));
return;
}
}
@@ -103,24 +86,11 @@ AsyncAccessManager::add_interest (ImR_ResponseHandler *rh)
}
}
}
-
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) AsyncAccessManager::add_interest: ")
- ACE_TEXT ("server = <%C>, status = %d returning\n"),
- this->info_->name.c_str(), this->status_));
}
void
AsyncAccessManager::final_state (void)
{
- if (this->locator_.debug() > 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) AsyncAccessManager::final_state: ")
- ACE_TEXT ("status = %d, server = <%C> list size = %d\n"),
- this->status_, this->info_->name.c_str(), rh_list_.size()));
- }
-
for (size_t i = 0; i < this->rh_list_.size(); i++)
{
ImR_ResponseHandler *rh = this->rh_list_[i];
@@ -183,13 +153,6 @@ AsyncAccessManager::status (AAM_Status s)
void
AsyncAccessManager::activator_replied (bool success)
{
- // if (this->locator_.debug() > 0)
- // {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) AsyncAccessManager::activator_replied: ")
- ACE_TEXT ("success = %d, status = %d\n"),
- success, this->status_));
- // }
if (success)
{
this->status (AAM_WAIT_FOR_RUNNING);
@@ -211,13 +174,6 @@ AsyncAccessManager::server_is_shutting_down (void)
void
AsyncAccessManager::server_is_running (const char *partial_ior)
{
- // if (this->locator_.debug() > 0)
- // {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t) AsyncAccessManager::server_is_running: ")
- ACE_TEXT ("name = %C, status = %d\n"),
- this->info_->name.c_str(), this->status_));
- // }
this->status (AAM_WAIT_FOR_ALIVE);
this->info_->partial_ior = partial_ior;
@@ -317,15 +273,12 @@ AsyncAccessManager::add_ref (void)
{
ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, 0);
++this->refcount_;
-
- ACE_DEBUG ((LM_DEBUG, "AAM (%x): add_ref count now = %d\n", this, this->refcount_));
return this;
}
void
AsyncAccessManager::remove_ref (void)
{
- ACE_DEBUG ((LM_DEBUG, "AAM (%x): remove_ref count pre decr = %d\n", this, this->refcount_));
ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
if (--this->refcount_ == 0)
{
@@ -339,24 +292,20 @@ AsyncAccessManager::remove_ref (void)
AsyncAccessManager_ptr::AsyncAccessManager_ptr (void)
: val_ (0)
{
- ACE_DEBUG ((LM_DEBUG,"AAM_Ptr (%x) ctor default\n", this));
}
AsyncAccessManager_ptr::AsyncAccessManager_ptr (AsyncAccessManager *aam)
:val_ (aam)
{
- ACE_DEBUG ((LM_DEBUG,"AAM_Ptr (%x) ctor taking ownership of aam = %x\n", this, aam));
}
AsyncAccessManager_ptr::AsyncAccessManager_ptr (const AsyncAccessManager_ptr &aam_ptr)
:val_ (aam_ptr.clone())
{
- ACE_DEBUG ((LM_DEBUG,"AAM_Ptr (%x) ctor taking ownership of aam_clone = %x\n", this, val_));
}
AsyncAccessManager_ptr::~AsyncAccessManager_ptr (void)
{
- ACE_DEBUG ((LM_DEBUG,"AAM_Ptr (%x) dtor releasing %x\n", this, val_));
if (val_ != 0)
{
val_->remove_ref();
@@ -366,8 +315,6 @@ AsyncAccessManager_ptr::~AsyncAccessManager_ptr (void)
AsyncAccessManager_ptr &
AsyncAccessManager_ptr::operator= (const AsyncAccessManager_ptr &aam_ptr)
{
- ACE_DEBUG ((LM_DEBUG,"AAM_Ptr (%x) assignment releasing %x, taking ownership of aam_clone = %x\n", this, val_, *aam_ptr));
-
if (val_ != *aam_ptr)
{
if (val_ != 0)
@@ -382,7 +329,6 @@ AsyncAccessManager_ptr::operator= (const AsyncAccessManager_ptr &aam_ptr)
AsyncAccessManager_ptr &
AsyncAccessManager_ptr::operator= (AsyncAccessManager *aam)
{
- ACE_DEBUG ((LM_DEBUG,"AAM_Ptr (%x) assignment releasing %x, taking ownership of aam = %x\n", this, val_, aam));
if (val_ != aam)
{
if (val_ != 0)
@@ -513,20 +459,16 @@ AsyncLiveListener::AsyncLiveListener (const char *server,
pinger_ (pinger),
status_ (LS_UNKNOWN)
{
- ACE_DEBUG ((LM_DEBUG, "AsyncLiveListener ctor, this = %x\n", this));
}
AsyncLiveListener::~AsyncLiveListener (void)
{
- ACE_DEBUG ((LM_DEBUG, "AsyncLiveListener dtor, this = %x\n", this));
}
bool
AsyncLiveListener::start (void)
{
bool rtn = this->pinger_.add_listener (this);
- ACE_DEBUG ((LM_DEBUG,
- "AsyncLiveListener::start, add_listener returned %d\n", rtn));
if (!rtn)
delete this;
return rtn;
@@ -542,8 +484,6 @@ AsyncLiveListener::status_changed (LiveStatus status)
}
else
{
- ACE_DEBUG ((LM_DEBUG,
- "AsyncLiveListener::status_changed, status = %d, deleting(%x)\n", status, this));
this->aam_->ping_replied (status);
delete this;
}
diff --git a/TAO/orbsvcs/ImplRepo_Service/Forwarder.cpp b/TAO/orbsvcs/ImplRepo_Service/Forwarder.cpp
index be164a29db3..b242d737989 100644
--- a/TAO/orbsvcs/ImplRepo_Service/Forwarder.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/Forwarder.cpp
@@ -53,7 +53,6 @@ ImR_DSI_Forwarder::init (CORBA::ORB_ptr orb)
}
catch (const CORBA::Exception&)
{
- ACE_DEBUG ((LM_DEBUG, "ImR_Forwarder::init() Exception ignored.\n"));
}
ACE_ASSERT (!CORBA::is_nil (this->poa_current_var_.in ()));
}
@@ -215,8 +214,8 @@ ImR_DSI_ResponseHandler::send_ior (const char *pior)
if (!CORBA::is_nil (forward_obj.in ()))
{
- PortableServer::ForwardRequest fwd (forward_obj.in ());
- TAO_AMH_DSI_Exception_Holder h(&fwd);
+ CORBA::Exception *fwd = new PortableServer::ForwardRequest (forward_obj.in ());
+ TAO_AMH_DSI_Exception_Holder h(fwd);
this->resp_->invoke_excep(&h);
delete this;
}
@@ -226,10 +225,10 @@ ImR_DSI_ResponseHandler::send_ior (const char *pior)
ACE_TEXT ("ImR_DSI_ResponseHandler::send_ior (): Forward_to ")
ACE_TEXT ("reference is nil.\n")));
- CORBA::OBJECT_NOT_EXIST ex (CORBA::SystemException::_tao_minor_code
- ( TAO_IMPLREPO_MINOR_CODE, 0),
- CORBA::COMPLETED_NO);
- TAO_AMH_DSI_Exception_Holder h(&ex);
+ CORBA::Exception *ex = new CORBA::OBJECT_NOT_EXIST (CORBA::SystemException::_tao_minor_code
+ ( TAO_IMPLREPO_MINOR_CODE, 0),
+ CORBA::COMPLETED_NO);
+ TAO_AMH_DSI_Exception_Holder h(ex);
this->resp_->invoke_excep(&h);
delete this;
}
diff --git a/TAO/orbsvcs/ImplRepo_Service/INS_Locator.cpp b/TAO/orbsvcs/ImplRepo_Service/INS_Locator.cpp
index 58562921a10..fb50d46c937 100644
--- a/TAO/orbsvcs/ImplRepo_Service/INS_Locator.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/INS_Locator.cpp
@@ -32,7 +32,7 @@ INS_Locator::locate (const char* object_key)
key = key.substring (0, poaidx);
}
- if (imr_locator_.debug () > 1)
+ if (imr_locator_.debug () > 0)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("ImR: Activating server <%s>.\n"),
key.c_str ()));
@@ -81,7 +81,7 @@ INS_Locator::locate (const char* object_key)
{
try
{
- if (imr_locator_.debug () > 1)
+ if (imr_locator_.debug () > 0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("ImR: Try activating server using <%s>.\n"),
diff --git a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp
index c4957666b0a..c5e21af13f4 100644
--- a/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/ImR_Locator_i.cpp
@@ -95,7 +95,7 @@ ImR_Locator_i::init_with_orb (CORBA::ORB_ptr orb, Options& opts)
this->dsi_forwarder_.init (orb);
this->adapter_.init (& this->dsi_forwarder_);
- this->pinger_.init (orb, ping_interval_);
+ this->pinger_.init (orb, ACE_Time_Value (10,0)); // ping_interval_);
// Register the Adapter_Activator reference to be the RootPOA's
// Adapter Activator.
@@ -498,8 +498,7 @@ ImR_Locator_i::activate_server_i (UpdateableServerInfo& info,
AsyncAccessManager *aam_raw;
ACE_NEW (aam_raw, AsyncAccessManager (*info, manual_start, *this));
aam = aam_raw;
- int result = this->aam_set_.insert (aam);
- ACE_DEBUG ((LM_DEBUG, "ImR_Locator_i::activate_server_i(PC) insert_aam returned %d\n", result));
+ this->aam_set_.insert (aam);
}
else
{
@@ -509,13 +508,10 @@ ImR_Locator_i::activate_server_i (UpdateableServerInfo& info,
AsyncAccessManager *aam_raw;
ACE_NEW (aam_raw, AsyncAccessManager (*info, manual_start, *this));
aam = aam_raw;
- ACE_DEBUG ((LM_DEBUG, "ImR_Locator_i::activate_server_i calling insert_aam size = %d\n", aam_set_.size()));
- int result = this->aam_set_.insert_tail (aam);
- ACE_DEBUG ((LM_DEBUG, "ImR_Locator_i::activate_server_i after insert_aam size = %d returned %d\n", aam_set_.size(), result));
+ this->aam_set_.insert_tail (aam);
}
}
aam->add_interest (rh);
- ACE_DEBUG ((LM_DEBUG, "ImR_Locator_i::activate_server_i returning\n"));
}
CORBA::Object_ptr
@@ -929,8 +925,7 @@ ImR_Locator_i::server_is_running
ACE_NEW (aam_raw, AsyncAccessManager (*temp_info, true, *this));
AsyncAccessManager_ptr aam (aam_raw);
aam->started_running ();
- int result = this->aam_set_.insert (aam);
- ACE_DEBUG ((LM_DEBUG, "ImR_Locator_i::server_is_running insert_aam returned %d\n", result));
+ this->aam_set_.insert (aam);
}
else
{
@@ -958,14 +953,11 @@ ImR_Locator_i::server_is_running
aam->server_is_running (partial_ior);
else
{
- ACE_DEBUG ((LM_DEBUG, "Server_Is_Running, %s not found in aam set\n",
- name.c_str()));
AsyncAccessManager *aam_raw;
ACE_NEW (aam_raw, AsyncAccessManager (*info, true, *this));
AsyncAccessManager_ptr aam (aam_raw);
aam->started_running ();
- int result = this->aam_set_.insert (aam);
- ACE_DEBUG ((LM_DEBUG, "ImR_Locator_i::server_is_running insert_aam returned %d\n", result));
+ this->aam_set_.insert (aam);
}
}
_tao_rh->server_is_running ();
@@ -1323,24 +1315,18 @@ ImR_Locator_i::root_poa (void)
void
ImR_Locator_i::remove_aam (AsyncAccessManager_ptr &aam)
{
- ACE_DEBUG ((LM_DEBUG, "ImR_Locator_i::remove_aam calling remove\n"));
- int result = this->aam_set_.remove (aam);
- ACE_DEBUG ((LM_DEBUG, "ImR_Locator_i::remove_aam, remove returned %d\n", result));
-
+ this->aam_set_.remove (aam);
}
AsyncAccessManager *
ImR_Locator_i::find_aam (const char *name)
{
- ACE_DEBUG ((LM_DEBUG, "ImR_Locator_i::find_aam called for %s, set size = %d\n", name, aam_set_.size()));
-
for (AAM_Set::ITERATOR i = this->aam_set_.begin();
i != this->aam_set_.end();
++i)
{
if ((*i)->has_server (name))
{
- ACE_DEBUG ((LM_DEBUG, "ImR_Locator_i::find_aam add ref and return\n"));
return (*i)->add_ref();
}
}
diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp
index 4368c369237..ccfb7affe78 100644
--- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.cpp
@@ -4,7 +4,7 @@
#include "LiveCheck.h"
#include "tao/ORB_Core.h"
#include "ace/Reactor.h"
-#include "ace/OS_NS_time.h"
+#include "ace/High_Res_Timer.h"
LiveListener::LiveListener (const char *server)
: server_(server)
@@ -54,7 +54,7 @@ LiveEntry::LiveEntry (LiveCheck *owner,
server_ (server),
ref_ (ImplementationRepository::ServerObject::_duplicate (ref)),
liveliness_ (LS_UNKNOWN),
- next_check_ (ACE_OS::time()),
+ next_check_ (ACE_High_Res_Timer::gettimeofday_hr()),
retry_count_ (0),
repings_ (0),
listeners_ (),
@@ -71,7 +71,6 @@ LiveEntry::add_listener (LiveListener* ll)
{
ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
this->listeners_.insert (ll);
- // ACE_DEBUG ((LM_DEBUG, "LiveEntry(%s)::add_listener\n", this->server_.c_str()));
}
LiveStatus
@@ -80,7 +79,7 @@ LiveEntry::status (void) const
if ( this->liveliness_ == LS_ALIVE &&
this->owner_->ping_interval() != ACE_Time_Value::zero )
{
- ACE_Time_Value now (ACE_OS::time());
+ ACE_Time_Value now (ACE_High_Res_Timer::gettimeofday_hr());
if (now >= this->next_check_)
{
return LS_UNKNOWN;
@@ -99,11 +98,9 @@ LiveEntry::status (LiveStatus l)
if (l == LS_ALIVE)
{
this->retry_count_ = 0;
- ACE_Time_Value now (ACE_OS::time());
+ ACE_Time_Value now (ACE_High_Res_Timer::gettimeofday_hr());
this->next_check_ = now + owner_->ping_interval();
}
- ACE_DEBUG ((LM_DEBUG, "LiveEntry(%s)::status updating listeners, size = %d\n",
- this->server_.c_str(), this->listeners_.size()));
Listen_Set remove;
@@ -144,10 +141,6 @@ LiveEntry::status (LiveStatus l)
{
this->owner_->schedule_ping (this);
}
-
- // ACE_DEBUG ((LM_DEBUG, "LiveEntry(%s)::status updating listeners done, size = %d\n",
- // this->server_.c_str(), this->listeners_.size()));
-
}
const ACE_Time_Value &
@@ -159,20 +152,16 @@ LiveEntry::next_check (void) const
bool
LiveEntry::do_ping (PortableServer::POA_ptr poa)
{
- ACE_Time_Value now (ACE_OS::time());
- if (this->liveliness_ == LS_PING_AWAY)
+ ACE_Time_Value now (ACE_High_Res_Timer::gettimeofday_hr());
+ if (this->liveliness_ == LS_PING_AWAY || this->listeners_.size() == 0)
{
- ACE_DEBUG ((LM_DEBUG, "LiveEntry(%s)::do_ping, ping_away_ is true\n",
- this->server_.c_str()));
return false;
}
if (this->next_check_ > now || this->liveliness_ == LS_DEAD)
{
ACE_Time_Value diff = next_check_ - now;
- ACE_DEBUG ((LM_DEBUG, "LiveEntry(%s)::do_ping, too soon = %d, come back in %d ms, status = %d\n",
- this->server_.c_str(), (this->next_check_ > now), diff.sec() * 1000 + (diff.usec() / 1000), liveliness_));
- return true;
+ return false;
}
switch (this->liveliness_)
@@ -194,8 +183,6 @@ LiveEntry::do_ping (PortableServer::POA_ptr poa)
}
else
{
- ACE_DEBUG ((LM_DEBUG, "LiveEntry(%s)::do_ping, transient, but no next\n",
- this->server_.c_str()));
return false;
}
}
@@ -208,8 +195,6 @@ LiveEntry::do_ping (PortableServer::POA_ptr poa)
this->liveliness_ = LS_PING_AWAY;
this->retry_count_++;
}
- ACE_DEBUG ((LM_DEBUG, "LiveEntry(%s)::do_ping, sending ping, retry count = %d\n",
- this->server_.c_str(), retry_count_));
PortableServer::ServantBase_var callback = new PingReceiver (this, poa);
PortableServer::ObjectId_var oid = poa->activate_object (callback.in());
CORBA::Object_var obj = poa->id_to_reference (oid.in());
@@ -235,7 +220,6 @@ PingReceiver::~PingReceiver (void)
void
PingReceiver::ping (void)
{
- ACE_DEBUG ((LM_DEBUG, "PingReceiver::ping\n"));
this->entry_->status (LS_ALIVE);
PortableServer::ObjectId_var oid = this->poa_->servant_to_id (this);
poa_->deactivate_object (oid.in());
@@ -246,7 +230,6 @@ PingReceiver::ping_excep (Messaging::ExceptionHolder * excep_holder)
{
try
{
- ACE_DEBUG ((LM_DEBUG, "PingReceiver::ping_excep\n"));
excep_holder->raise_exception ();
}
catch (CORBA::TRANSIENT &ex)
@@ -284,7 +267,8 @@ PingReceiver::ping_excep (Messaging::ExceptionHolder * excep_holder)
LiveCheck::LiveCheck ()
:ping_interval_(),
- running_ (false)
+ running_ (false),
+ token_ (100)
{
}
@@ -327,14 +311,34 @@ LiveCheck::ping_interval (void) const
int
LiveCheck::handle_timeout (const ACE_Time_Value &,
- const void *)
+ const void */*tok*/)
{
- ACE_DEBUG ((LM_DEBUG, "LiveCheck::handle_timeout running = %d\n", this->running_));
+ // long token = reinterpret_cast<long>(tok);
if (!this->running_)
return -1;
bool want_reping = false;
ACE_Time_Value next;
+ LiveEntryMap::iterator the_end = this->entry_map_.end();
+ for (LiveEntryMap::iterator le = this->entry_map_.begin();
+ le != the_end;
+ ++le)
+ {
+ if (le->item ()->do_ping (poa_.in ()))
+ {
+ LiveStatus status = le->item ()->status ();
+ if (status != LS_DEAD)
+ {
+ if (!want_reping || le->item ()->next_check() < next)
+ {
+ want_reping = true;
+ next = le->item ()->next_check();
+ }
+ }
+ }
+
+ }
+#if 0
for (LiveEntryMap::iterator le (this->entry_map_);
!le.done ();
le.advance ())
@@ -354,6 +358,7 @@ LiveCheck::handle_timeout (const ACE_Time_Value &,
}
}
}
+#endif
for (PerClientStack::ITERATOR pe (this->per_client_);
!pe.done ();
pe.advance ())
@@ -387,11 +392,10 @@ LiveCheck::handle_timeout (const ACE_Time_Value &,
if (want_reping)
{
- ACE_Time_Value now (ACE_OS::time());
+ ACE_Time_Value now (ACE_High_Res_Timer::gettimeofday_hr());
ACE_Time_Value delay = next - now;
- ACE_DEBUG ((LM_DEBUG, "LiveCheck::handle_timeout schdeuling next - in %d ms \n",
- delay.sec() * 1000 + (delay.usec()/1000)));
- this->reactor()->schedule_timer (this, 0, delay);
+ ++this->token_;
+ this->reactor()->schedule_timer (this, reinterpret_cast<void *>(this->token_), delay);
}
return 0;
@@ -444,7 +448,11 @@ LiveCheck::add_per_client_listener (LiveListener *l,
if (this->per_client_.push(entry) == 0)
{
entry->add_listener (l);
- this->reactor()->schedule_timer (this,0,ACE_Time_Value::zero);
+
+ ++this->token_;
+ this->reactor()->schedule_timer (this,
+ reinterpret_cast<void *>(this->token_),
+ ACE_Time_Value::zero);
return true;
}
return false;
@@ -475,20 +483,27 @@ LiveCheck::schedule_ping (LiveEntry *entry)
if (!this->running_)
return;
- ACE_Time_Value now (ACE_OS::time());
- ACE_Time_Value next = entry->next_check ();
+ LiveStatus status = entry->status();
+ if (status == LS_PING_AWAY || status == LS_DEAD)
+ {
+ return;
+ }
+ ACE_Time_Value now (ACE_High_Res_Timer::gettimeofday_hr());
+ ACE_Time_Value next = entry->next_check ();
+ ++this->token_;
if (next <= now)
{
- ACE_DEBUG ((LM_DEBUG, "LiveCheck::schedule_ping - immediate \n"));
- this->reactor()->schedule_timer (this,0,ACE_Time_Value::zero);
+ this->reactor()->schedule_timer (this,
+ reinterpret_cast<void *>(this->token_),
+ ACE_Time_Value::zero);
}
else
{
ACE_Time_Value delay = next - now;
- ACE_DEBUG ((LM_DEBUG, "LiveCheck::schedule_ping - in %dms \n",
- delay.sec() * 1000 + (delay.usec()/1000)));
- this->reactor()->schedule_timer (this, 0, delay);
+ this->reactor()->schedule_timer (this,
+ reinterpret_cast<void *>(this->token_),
+ delay);
}
}
diff --git a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h
index db658905c04..5d731a411f6 100644
--- a/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h
+++ b/TAO/orbsvcs/ImplRepo_Service/LiveCheck.h
@@ -201,6 +201,7 @@ class Locator_Export LiveCheck : public ACE_Event_Handler
PortableServer::POA_var poa_;
ACE_Time_Value ping_interval_;
bool running_;
+ int token_;
};
#endif /* IMR_LIVECHECK_H_ */
diff --git a/TAO/utils/logWalker/HostProcess.cpp b/TAO/utils/logWalker/HostProcess.cpp
index e8adc928c89..e2449b14b0a 100644
--- a/TAO/utils/logWalker/HostProcess.cpp
+++ b/TAO/utils/logWalker/HostProcess.cpp
@@ -25,7 +25,7 @@ HostProcess::~HostProcess (void)
!i.done();
i++)
{
- delete reinterpret_cast<ACE_CString *>(i.next()->item_);
+ delete reinterpret_cast<Endpoint *>(i.next()->item_);
}
for (ThreadList::ITERATOR i(this->threads_);
!i.done();
@@ -77,9 +77,10 @@ HostProcess::find_thread (long tid, size_t offset)
}
Thread *
-HostProcess::find_thread_for_peer (const ACE_CString &addr, Session &session)
+HostProcess::find_thread_for_peer (const ACE_CString &addr)
{
Thread *thr = 0;
+ Endpoint ep (addr.c_str());
for (ACE_DLList_Iterator<Thread> i(threads_);
!i.done();
i.advance())
@@ -89,7 +90,7 @@ HostProcess::find_thread_for_peer (const ACE_CString &addr, Session &session)
if (pp == 0)
continue;
- if (pp->match_server_addr(addr, session))
+ if (pp->match_server_addr(ep))
return thr;
}
return 0;
@@ -115,7 +116,8 @@ HostProcess::find_peer (const ACE_CString &addr)
{
PeerProcess *pp = 0;
- (void)this->by_addr_.find(addr,pp);
+ Endpoint ep (addr.c_str());
+ (void)this->by_addr_.find(ep,pp);
return pp;
}
@@ -143,31 +145,31 @@ HostProcess::pid (void) const
}
bool
-HostProcess::has_endpoint (ACE_CString& addr, bool listen)
+HostProcess::has_endpoint (const Endpoint& addr, bool listen)
{
- ACE_CString *a = 0;
AddrList &list = listen ? this->listen_endpoints_ : this->client_endpoints_;
- for (ACE_DLList_Iterator<ACE_CString> i(list);
+ for (ACE_DLList_Iterator<Endpoint> i(list);
!i.done();
- i.advance())
+ ++i)
{
- i.next(a);
- if (*a == addr)
+ Endpoint *elem;
+ i.next (elem);
+ if (*elem == addr)
return true;
}
return false;
}
void
-HostProcess::add_client_endpoint(ACE_CString &addr)
+HostProcess::add_client_endpoint(const Endpoint &addr)
{
- this->client_endpoints_.insert_tail(new ACE_CString (addr));
+ this->client_endpoints_.insert_tail(new Endpoint (addr));
}
void
-HostProcess::add_listen_endpoint(ACE_CString &addr)
+HostProcess::add_listen_endpoint(const Endpoint &addr)
{
- this->listen_endpoints_.insert_tail(new ACE_CString (addr));
+ this->listen_endpoints_.insert_tail(new Endpoint (addr));
}
void
@@ -181,11 +183,12 @@ HostProcess::add_peer(long handle, PeerProcess *peer)
"add_peer, found existing for %d\n",
handle));
}
- const ACE_CString &addr = peer->is_server() ?
+ const Endpoint &addr = peer->is_server() ?
peer->server_addr() : peer->last_client_addr();
int result = this->by_addr_.bind (addr,peer);
if (result < 0)
- ACE_ERROR ((LM_ERROR,"add_peer, cannot bind to addr %s result = %d, %p\n", addr.c_str(), result, "by_addr_.bind"));
+ ACE_ERROR ((LM_ERROR,"add_peer, cannot bind to addr %s result = %d, %p\n",
+ addr.addr_.c_str(), result, "by_addr_.bind"));
PeerNode *node = new PeerNode (handle,peer);
this->by_handle_.insert_tail(node);
@@ -218,13 +221,13 @@ HostProcess::dump_summary (ostream &strm)
{
strm << " listening on ";
size_t count = 0;
- for (ACE_DLList_Iterator <ACE_CString> t_iter (this->listen_endpoints_);
+ for (ACE_DLList_Iterator <Endpoint> t_iter (this->listen_endpoints_);
!t_iter.done();
t_iter.advance())
{
- ACE_CString *ep = 0;
+ Endpoint *ep = 0;
t_iter.next(ep);
- strm << ep->c_str();
+ strm << ep->addr_.c_str();
if (++count < num)
strm << ", ";
}
diff --git a/TAO/utils/logWalker/HostProcess.h b/TAO/utils/logWalker/HostProcess.h
index 5cd9f65b8a4..3ae936ee648 100644
--- a/TAO/utils/logWalker/HostProcess.h
+++ b/TAO/utils/logWalker/HostProcess.h
@@ -33,8 +33,8 @@ struct PeerNode
typedef ACE_DLList<Thread> ThreadList;
typedef ACE_DLList<PeerNode> PeerArray;
-typedef ACE_DLList<ACE_CString> AddrList;
-typedef ACE_RB_Tree<ACE_CString, PeerProcess *, ACE_Less_Than<ACE_CString>, ACE_Null_Mutex> PeerProcs;
+typedef ACE_DLList<Endpoint> AddrList;
+typedef ACE_RB_Tree<Endpoint, PeerProcess *, ACE_Less_Than<Endpoint>, ACE_Null_Mutex> PeerProcs;
/*
* HostProcess encapsulates the state related a specific process instance
@@ -58,7 +58,7 @@ public:
Thread * find_thread (long tid, size_t offset);
// Returns a thread that has a pending peer with the supplied address
- Thread * find_thread_for_peer (const ACE_CString& addr, Session &session);
+ Thread * find_thread_for_peer (const ACE_CString& addr);
// Returns a thread that had previously worked with handle h. May return
// a null pointer.
@@ -70,15 +70,15 @@ public:
// returns true if the supplied endpoint has been visited before. This
// may be either a listen endpoint or a client endpoint used to connect
// to another peer.
- bool has_endpoint (ACE_CString& addr, bool listen);
+ bool has_endpoint (const Endpoint& addr, bool listen);
// adds a new endpoint to the list of listen endpoints. Client endpoints
// are added as part of the process to add a new peer process
- void add_client_endpoint (ACE_CString& addr);
+ void add_client_endpoint (const Endpoint& addr);
// adds a new endpoint to the list of listen endpoints. Client endpoints
// are added as part of the process to add a new peer process
- void add_listen_endpoint (ACE_CString& addr);
+ void add_listen_endpoint (const Endpoint& addr);
// add a peer to the connection list. If the peer is not in the
// by_addr_ table, it will be added there too.
diff --git a/TAO/utils/logWalker/Log.cpp b/TAO/utils/logWalker/Log.cpp
index d41453a67a5..0d66aeda899 100644
--- a/TAO/utils/logWalker/Log.cpp
+++ b/TAO/utils/logWalker/Log.cpp
@@ -162,7 +162,7 @@ Log::get_preamble ()
}
}
- this->session_.add_process(this->hostproc_);
+ this->session_.add_process (this->hostproc_);
}
this->thr_ = this->hostproc_->find_thread (tid, this->offset_);
return;
@@ -338,7 +338,7 @@ Log::parse_open_listener_i (void)
char *addr = ACE_OS::strchr(this->info_,'<') +1;
char *c = ACE_OS::strchr(addr,'>');
*c = '\0';
- ACE_CString server_addr(addr);
+ Endpoint server_addr(addr);
this->hostproc_->add_listen_endpoint(server_addr);
}
@@ -548,7 +548,7 @@ Log::parse_complete_connection_i (void)
{
PeerProcess *waiter = 0;
c_iter.next(waiter);
- if (waiter != 0 && waiter->match_server_addr (addr, session_))
+ if (waiter != 0 && waiter->match_server_addr (addr))
{
c_iter.remove();
// ACE_DEBUG ((LM_DEBUG,"%d: complete_connection: purging waiter\n",this->offset_));
@@ -597,7 +597,7 @@ Log::parse_handler_open_i (bool is_ssl)
{
PeerProcess *waiter = 0;
c_iter.next(waiter);
- if (waiter != 0 && waiter->match_server_addr (addr, session_))
+ if (waiter != 0 && waiter->match_server_addr (addr))
{
pp = waiter;
c_iter.remove();
@@ -629,7 +629,7 @@ Log::parse_handler_open_i (bool is_ssl)
{
if (pp->is_server())
{
- Transport *t = new Transport (addr, true, this->offset_);
+ Transport *t = new Transport (local_addr.c_str(), true, this->offset_);
pp->add_transport (t);
this->hostproc_->add_client_endpoint (t->client_endpoint_);
}
diff --git a/TAO/utils/logWalker/PeerProcess.cpp b/TAO/utils/logWalker/PeerProcess.cpp
index f3c03a6b03f..3d4dbfac7ce 100644
--- a/TAO/utils/logWalker/PeerProcess.cpp
+++ b/TAO/utils/logWalker/PeerProcess.cpp
@@ -10,11 +10,88 @@
#include "Thread.h"
#include "Session.h"
+Endpoint::Endpoint (void)
+ : addr_ (),
+ host_ (),
+ port_ (),
+ is_localhost_ (false),
+ role_ (ER_UNKNOWN)
+{
+}
+
+Endpoint::Endpoint (const char *addr, EndpointRole role)
+ : addr_ (),
+ host_ (),
+ port_ (),
+ is_localhost_ (false),
+ role_ (ER_UNKNOWN)
+{
+ this->assign (addr, role);
+}
+
+Endpoint::Endpoint (const Endpoint &other)
+{
+ operator = (other);
+}
+
+void
+Endpoint::assign (const char *addr, EndpointRole role)
+{
+ this->addr_ = addr;
+ this->role_ = role;
+ size_t p = addr_.rfind (':');
+ this->port_ = addr_.substring(p);
+ this->host_ = addr_.substring(0,p);
+
+ this->is_localhost_ = this->host_ == "localhost" ||
+ this->host_ == "127.0.0.1" || this->host_ == "[::1]";
+}
+
+Endpoint&
+Endpoint::operator = (const Endpoint &other)
+{
+ this->addr_ = other.addr_;
+ this->role_ = other.role_;
+ this->host_ = other.host_;
+ this->port_ = other.port_;
+ this->is_localhost_ = other.is_localhost_;
+ return *this;
+}
+
+bool
+Endpoint::operator == (const Endpoint &other) const
+{
+ if (this->port_ != other.port_)
+ return false;
+ if (this->is_localhost_ != other.is_localhost_)
+ return false;
+ if (this->is_localhost_)
+ return true;
+ if (this->host_ == other.host_)
+ return true;
+ return Session::is_equivalent (this->host_, other.host_);
+}
+
+bool
+Endpoint::operator < (const Endpoint &other) const
+{
+ if (this->port_ < other.port_)
+ return true;
+ if (this->host_ < other.host_)
+ return true;
+ return false;
+}
+
+bool
+Endpoint::is_client (void) const
+{
+ return this->role_ != ER_SERVER;
+}
+
Transport::Transport (const char *addr, bool is_client, size_t offset)
: handle_ (0),
- client_endpoint_ (addr),
- local_is_client_ (is_client),
+ client_endpoint_ (addr, is_client ? ER_CLIENT : ER_SERVER),
open_offset_ (offset),
close_offset_ (0)
{
@@ -32,11 +109,9 @@ PeerProcess::nextIdent(bool is_server)
PeerProcess::PeerProcess (size_t offset, bool is_server)
: owner_ (0),
remote_ (0),
- server_port_(),
- server_host_(),
- server_(is_server),
+ server_ep_(),
+ is_server_role_(is_server),
ssl_(false),
- localhost_(false),
origin_offset_ (offset),
objects_ (),
object_by_index_ ()
@@ -64,41 +139,22 @@ PeerProcess::~PeerProcess (void)
void
PeerProcess::set_server_addr (const ACE_CString &addr)
{
- size_t p = addr.rfind (':');
- this->server_port_ = addr.substring(p);
- this->server_host_ = addr.substring(0,p);
-
- this->localhost_ = this->server_host_ == "localhost" ||
- this->server_host_ == "127.0.0.1" || this->server_host_ == "[::1]";
+ this->server_ep_.assign (addr.c_str(), this->is_server_role_ ? ER_SERVER : ER_CLIENT);
}
bool
-PeerProcess::match_server_addr (const ACE_CString &addr, Session &session) const
+PeerProcess::match_server_addr (const Endpoint &addr) const
{
- size_t p = addr.rfind (':');
- ACE_CString port = addr.substring (p);
- ACE_CString host = addr.substring (0,p);
- if (port != this->server_port_)
- return false;
-
- if (this->localhost_)
- {
- return host == "localhost" || host == "127.0.0.1" || host == "[::1]";
- }
-
- if (this->server_host_ == host)
- return true;
-
- return session.is_equivalent (this->server_host_, host);
+ return this->server_ep_ == addr;
}
-ACE_CString
+const Endpoint &
PeerProcess::server_addr (void) const
{
- return this->server_host_ + this->server_port_;
+ return this->server_ep_;
}
-const ACE_CString&
+const Endpoint &
PeerProcess::last_client_addr (void) const
{
return this->last_transport_->client_endpoint_;
@@ -107,7 +163,7 @@ PeerProcess::last_client_addr (void) const
bool
PeerProcess::is_server (void) const
{
- return this->server_;
+ return this->is_server_role_;
}
size_t
@@ -159,8 +215,8 @@ PeerProcess::match_hosts (Session *session)
// on the server addr. But if the local side is the server
// then this wants to find the remote based on the Transport
// instance
- if (this->server_)
- this->remote_ = session->find_host(this->server_host_, true);
+ if (this->is_server_role_)
+ this->remote_ = session->find_host(this->server_ep_, true);
else
{
Transport *t = 0;
@@ -272,11 +328,11 @@ PeerProcess::dump_summary (ostream &strm)
strm << " is a ";
if (this->ssl_)
strm << "secure ";
- if (this->server_)
+ if (this->is_server_role_)
strm << "server at ";
else
strm << "client to ";
- strm << this->server_host_ << this->server_port_;
+ strm << this->server_ep_.host_ << ":" << this->server_ep_.port_;
strm << " with " << num_transports << " connections, ";
strm << " referenced " << this->objects_.current_size()
<< " objects in " << this->invocations_.size() << " invocations";
@@ -288,8 +344,8 @@ PeerProcess::dump_summary (ostream &strm)
Transport *tran = 0;
i.next(tran);
strm << " connection[" << tran->handle_ << "] ";
- strm << (tran->local_is_client_ ? "to " : "from ");
- strm << tran->client_endpoint_;
+ strm << (tran->client_endpoint_.is_client() ? "to " : "from ");
+ strm << tran->client_endpoint_.host_ << ":" << tran->client_endpoint_.port_;
strm << " created line " << tran->open_offset_;
if (tran->close_offset_)
strm << " closed line " << tran->close_offset_;
@@ -302,7 +358,7 @@ PeerProcess::dump_object_detail (ostream &strm)
{
strm << this->objects_.current_size()
<< " Objects referenced";
- if (this->server_)
+ if (this->is_server_role_)
strm << " in ";
else
strm << " by ";
@@ -329,7 +385,7 @@ void
PeerProcess::dump_invocation_detail (ostream &strm)
{
strm << "\n " << this->invocations_.size() << " Invocations ";
- strm << (this->server_ ? "to " : "from ");
+ strm << (this->is_server_role_ ? "to " : "from ");
if (this->remote_)
strm << remote_->proc_name();
else
diff --git a/TAO/utils/logWalker/PeerProcess.h b/TAO/utils/logWalker/PeerProcess.h
index f90e4004c34..91378d7d9dd 100644
--- a/TAO/utils/logWalker/PeerProcess.h
+++ b/TAO/utils/logWalker/PeerProcess.h
@@ -19,13 +19,38 @@ class Invocation;
class Session;
class Thread;
+
+enum EndpointRole {
+ ER_UNKNOWN,
+ ER_CLIENT,
+ ER_SERVER
+};
+
+class Endpoint
+{
+public:
+ Endpoint (void);
+ Endpoint (const Endpoint &other);
+ Endpoint (const char *addr, EndpointRole role = ER_UNKNOWN);
+ void assign (const char *addr, EndpointRole role = ER_UNKNOWN);
+ Endpoint & operator = (const Endpoint &other);
+ bool operator == (const Endpoint &other) const;
+ bool operator < (const Endpoint &other) const;
+ bool is_client (void) const;
+
+ ACE_CString addr_;
+ ACE_CString host_;
+ ACE_CString port_;
+ bool is_localhost_;
+ EndpointRole role_;
+};
+
class Transport
{
public:
Transport (const char *addr, bool is_client, size_t offset);
long handle_;
- ACE_CString client_endpoint_;
- bool local_is_client_;
+ Endpoint client_endpoint_;
size_t open_offset_;
size_t close_offset_;
};
@@ -51,8 +76,8 @@ public:
void match_hosts (Session *session);
void set_server_addr (const ACE_CString &addr);
- ACE_CString server_addr (void) const;
- const ACE_CString &last_client_addr (void) const;
+ const Endpoint &server_addr (void) const;
+ const Endpoint &last_client_addr (void) const;
bool is_server (void) const;
size_t offset (void) const;
@@ -62,7 +87,7 @@ public:
Transport *find_transport (long handle);
bool match_local (const char *addr) const;
- bool match_server_addr (const ACE_CString &addr, Session &session) const;
+ bool match_server_addr (const Endpoint &addr) const;
Invocation *new_invocation (size_t req_id, Thread *thr);
Invocation *find_invocation (size_t req_id, long handle);
@@ -79,13 +104,11 @@ private:
char *origin_;
HostProcess *owner_;
HostProcess *remote_;
- ACE_CString server_port_;
- ACE_CString server_host_;
+ Endpoint server_ep_;
TransportList transports_;
Transport *last_transport_;
- bool server_;
+ bool is_server_role_;
bool ssl_;
- bool localhost_;
size_t origin_offset_;
PeerObjectTable objects_;
InvocationList invocations_;
diff --git a/TAO/utils/logWalker/Session.cpp b/TAO/utils/logWalker/Session.cpp
index 8f194415417..e9490844ad4 100644
--- a/TAO/utils/logWalker/Session.cpp
+++ b/TAO/utils/logWalker/Session.cpp
@@ -2,6 +2,7 @@
#include "Session.h"
#include "HostProcess.h"
+#include "PeerProcess.h"
#include "Log.h"
#include "ace/OS_NS_strings.h"
#include "ace/SString.h"
@@ -10,6 +11,10 @@
long
Session::tao_version_ = 200;
+AltAddresses
+Session::alt_addrs_;
+
+
Session::Session (void)
{
ACE_CString n ("localhost");
@@ -72,7 +77,7 @@ Session::alternate_address (const char *addrspec)
return;
ACE_CString name (addrspec,(equal - addrspec));
ACE_CString value (equal+1);
- this->alt_addrs_.bind(name,value);
+ Session::alt_addrs_.bind(name,value);
}
bool
@@ -81,7 +86,7 @@ Session::is_equivalent (const ACE_CString &primary,
{
ACE_CString test(primary);
ACE_CString alt;
- if (this->alt_addrs_.find(test,alt) == 0)
+ if (Session::alt_addrs_.find(test,alt) == 0)
{
return alt == alternate;
}
@@ -95,13 +100,13 @@ Session::default_service (const char *addrspec)
if (equal == 0)
return;
ACE_CString name (addrspec,(equal - addrspec));
- ACE_CString endpoint (equal+1);
+ Endpoint ep (equal+1);
static long next_def_pid = 0;
--next_def_pid;
HostProcess *hp = new HostProcess ("defaulted",next_def_pid);
hp->proc_name(name);
- hp->add_listen_endpoint (endpoint);
+ hp->add_listen_endpoint (ep);
this->processes_.bind(next_def_pid,hp);
this->procs_by_name_.bind(name,hp);
}
@@ -117,26 +122,36 @@ Session::find_process (long pid)
}
HostProcess *
-Session::find_host (ACE_CString &endpoint, bool server)
+Session::find_host_i (const Endpoint &endpoint, bool server)
{
- ACE_CString test(endpoint);
- ACE_CString alternate;
- size_t sep = test.find(':');
- if (this->alt_addrs_.find(test.substring (0,sep),alternate) == 0)
- {
- test = alternate + test.substring(sep);
- }
for (Processes::ITERATOR i (this->processes_); !i.done(); i.advance())
{
Processes::ENTRY *entry;
if (i.next(entry) == 0)
break;
- if (entry->item()->has_endpoint(test, server))
+ if (entry->item()->has_endpoint(endpoint, server))
return entry->item();
}
return 0;
}
+HostProcess *
+Session::find_host (const Endpoint &endpoint, bool server)
+{
+ HostProcess *result = find_host_i (endpoint, server);
+ if (result != 0)
+ return result;
+
+ Endpoint test (endpoint);
+ ACE_CString alternate;
+ if (Session::alt_addrs_.find(endpoint.host_,alternate) == 0)
+ {
+ test.host_ = alternate;
+ return find_host_i (test, server);
+ }
+ return 0;
+}
+
void
Session::make_dir (const char *dirname)
{
diff --git a/TAO/utils/logWalker/Session.h b/TAO/utils/logWalker/Session.h
index 2f4bfb0c85d..bfb8c8da6aa 100644
--- a/TAO/utils/logWalker/Session.h
+++ b/TAO/utils/logWalker/Session.h
@@ -14,6 +14,7 @@
class Log;
class HostProcess;
+class Endpoint;
typedef ACE_RB_Tree<long, HostProcess *, ACE_Less_Than<long>, ACE_Null_Mutex> Processes;
typedef ACE_RB_Tree<ACE_CString, HostProcess *, ACE_Less_Than<ACE_CString>, ACE_Null_Mutex> Procs_By_Name;
@@ -28,14 +29,14 @@ public:
void add_process (HostProcess *proc);
HostProcess *find_process (long pid);
- HostProcess *find_host (ACE_CString &endpoint, bool server);
+ HostProcess *find_host (const Endpoint &endpoint, bool server);
void reconcile (void);
static bool set_tao_version (ACE_TCHAR *str);
static long tao_version (void);
- void alternate_address (const char *string);
- bool is_equivalent (const ACE_CString &primary,
- const ACE_CString &alternate);
+ static void alternate_address (const char *string);
+ static bool is_equivalent (const ACE_CString &primary,
+ const ACE_CString &alternate);
void default_service (const char *string);
void make_dir (const char * );
@@ -47,14 +48,16 @@ public:
void dump ();
private:
+ HostProcess *find_host_i (const Endpoint &endpoint, bool server);
+
ostream * stream_for ( ostream *, HostProcess * = 0, const char * = 0);
Processes processes_;
Procs_By_Name procs_by_name_;
- AltAddresses alt_addrs_;
ACE_CString base_dir_;
ACE_CString outfile_;
static long tao_version_;
+ static AltAddresses alt_addrs_;
};
#endif // LOG_WALKER_SESSION_H