diff options
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLog | 19 | ||||
-rw-r--r-- | TAO/tao/IIOP_Connection_Handler.cpp | 44 | ||||
-rw-r--r-- | TAO/tao/IIOP_Connection_Handler.h | 5 | ||||
-rw-r--r-- | TAO/tao/LF_CH_Event.cpp | 29 | ||||
-rw-r--r-- | TAO/tao/Transport_Connector.cpp | 45 |
5 files changed, 122 insertions, 20 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 36b6edfaaf9..1401f0e2bdd 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,22 @@ +Fri Sep 5 21:33:11 UTC 2008 Adam Mitz <mitza@ociweb.com> + + * tao/Transport_Connector.cpp (wait_for_transport): + + In the timeout case (before waiting), purge from cache but don't + close. This is effectively a partial revert of the change from + Wed Aug 13 16:21:34 UTC 2008 Adam Mitz <mitza@ociweb.com> + Also added logging in both wait_for_transport() and + wait_for_connection_completion() when the LF state is reset. + + * tao/IIOP_Connection_Handler.h: + * tao/IIOP_Connection_Handler.cpp: + * tao/LF_CH_Event.cpp: + + Added logging for connection handler (transport) reference counting + and LF state changes. The log messages are only output at level 10. + Logging every add_reference() and remove_reference() call is only + compiled-in when the macro TAO_LOG_CH_REF_COUNTS is defined. + Fri Sep 5 19:55:17 UTC 2008 Ciju John <johnc at ociweb dot com> * tests/Big_Request_Muxing/Client_Task.cpp: diff --git a/TAO/tao/IIOP_Connection_Handler.cpp b/TAO/tao/IIOP_Connection_Handler.cpp index 1e04b0a522e..8a4e28190ee 100644 --- a/TAO/tao/IIOP_Connection_Handler.cpp +++ b/TAO/tao/IIOP_Connection_Handler.cpp @@ -21,6 +21,36 @@ ACE_RCSID (tao, TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +#ifdef TAO_LOG_CH_REF_COUNTS +ACE_Event_Handler::Reference_Count +TAO_IIOP_Connection_Handler::add_reference (void) +{ + Reference_Count rc = TAO_IIOP_SVC_HANDLER::add_reference (); + if (TAO_debug_level > 9) + { + ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - IIOP_Connection_Handler[%d]::" + "add_reference, up to %d\n", this->transport (), rc)); + } + return rc; + +} + +ACE_Event_Handler::Reference_Count +TAO_IIOP_Connection_Handler::remove_reference (void) +{ + TAO_Transport *tport = this->transport (); + Reference_Count rc = TAO_IIOP_SVC_HANDLER::remove_reference (); + if (TAO_debug_level > 9) + { + ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - IIOP_Connection_Handler[%d]::" + "remove_reference, down to %d\n", tport, rc)); + } + return rc; +} +#endif /*TAO_LOG_CH_REF_COUNTS*/ + + TAO_IIOP_Connection_Handler::TAO_IIOP_Connection_Handler (ACE_Thread_Manager *t) : TAO_IIOP_SVC_HANDLER (t, 0 , 0), TAO_Connection_Handler (0), @@ -45,6 +75,13 @@ TAO_IIOP_Connection_Handler::TAO_IIOP_Connection_Handler ( ACE_NEW (specific_transport, TAO_IIOP_Transport (this, orb_core)); + if (TAO_debug_level > 9) + { + ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - IIOP_Connection_Handler[%d] ctor, " + "this = %d\n", + static_cast<TAO_Transport *> (specific_transport), this)); + } + // store this pointer (indirectly increment ref count) this->transport (specific_transport); } @@ -330,7 +367,12 @@ TAO_IIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &, int const ret = this->close (); this->reset_state (TAO_LF_Event::LFS_TIMEOUT); - + if (TAO_debug_level > 9) + { + ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - TAO_IIOP_Connection_Handler[%d]::" + "handle_timeout reset state to LFS_TIMEOUT\n", + this->transport ()-> id())); + } return ret; } diff --git a/TAO/tao/IIOP_Connection_Handler.h b/TAO/tao/IIOP_Connection_Handler.h index 2c2e64c1ae9..067c4768be1 100644 --- a/TAO/tao/IIOP_Connection_Handler.h +++ b/TAO/tao/IIOP_Connection_Handler.h @@ -61,6 +61,11 @@ class TAO_Export TAO_IIOP_Connection_Handler : public TAO_IIOP_SVC_HANDLER, public: +#ifdef TAO_LOG_CH_REF_COUNTS + Reference_Count add_reference (void); + Reference_Count remove_reference (void); +#endif + TAO_IIOP_Connection_Handler (ACE_Thread_Manager * = 0); /// Constructor. diff --git a/TAO/tao/LF_CH_Event.cpp b/TAO/tao/LF_CH_Event.cpp index c093f41eba2..ad843e27ffd 100644 --- a/TAO/tao/LF_CH_Event.cpp +++ b/TAO/tao/LF_CH_Event.cpp @@ -1,5 +1,8 @@ #include "tao/LF_CH_Event.h" #include "tao/LF_Follower.h" +#include "tao/debug.h" +#include "tao/Connection_Handler.h" +#include "tao/Transport.h" ACE_RCSID(tao, LF_Invocation_Event, @@ -36,6 +39,20 @@ TAO_LF_CH_Event::state_changed_i (int new_state) if (this->state_ != new_state) { this->validate_state_change (new_state); + + if (TAO_debug_level > 9) + { + size_t id = 0; + TAO_Connection_Handler *ch = 0; + if ((ch = dynamic_cast<TAO_Connection_Handler *> (this)) + && ch->transport ()) + { + id = ch->transport ()->id (); + } + ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - TAO_LF_CH_Event[%d]::" + "state_changed_i state %d prev %d\n", + id, state_, prev_state_)); + } } ACE_MT (ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->followers_.mutex ())); @@ -119,6 +136,18 @@ TAO_LF_CH_Event::set_state (int new_state) && new_state == TAO_LF_Event::LFS_TIMEOUT) { this->state_ = new_state; + if (TAO_debug_level > 9) + { + size_t id = 0; + TAO_Connection_Handler *ch = 0; + if ((ch = dynamic_cast<TAO_Connection_Handler *> (this)) && + ch->transport ()) + { + id = ch->transport ()->id (); + } + ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - TAO_LF_CH_Event[%d]::set_state " + "state_ is LFS_TIMEOUT\n", id)); + } } } diff --git a/TAO/tao/Transport_Connector.cpp b/TAO/tao/Transport_Connector.cpp index 17d266fec26..bb692599821 100644 --- a/TAO/tao/Transport_Connector.cpp +++ b/TAO/tao/Transport_Connector.cpp @@ -352,25 +352,26 @@ TAO_Connector::wait_for_transport (TAO::Profile_Transport_Resolver *r, ACE_Time_Value *timeout, bool force_wait) { - bool is_timeout = transport->connection_handler ()->is_timeout (); - if (is_timeout || transport->connection_handler ()->is_closed ()) + if (transport->connection_handler ()->is_timeout ()) { if (TAO_debug_level > 2) { - if (is_timeout) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - TAO_Connector::wait_for_transport, ") - ACE_TEXT ("transport [%d], Connection Timed out.\n"), - transport->id ())); - } - else - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - TAO_Connector::wait_for_transport, ") - ACE_TEXT ("transport [%d], Connection failed. (%d)\n"), - transport->id (), errno)); - } + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - TAO_Connector::wait_for_transport, ") + ACE_TEXT ("transport [%d], Connection Timed out.\n"), + transport->id ())); + } + transport->purge_entry (); + return false; + } + else if (transport->connection_handler ()->is_closed ()) + { + if (TAO_debug_level > 2) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - TAO_Connector::wait_for_transport, ") + ACE_TEXT ("transport [%d], Connection failed. (%d)\n"), + transport->id (), errno)); } // purge from the connection cache. If we are not in the @@ -467,9 +468,9 @@ TAO_Connector::wait_for_transport (TAO::Profile_Transport_Resolver *r, if (TAO_debug_level > 2) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("TAO (%P|%t) - TAO_Connector::wait_for_transport, ") - ACE_TEXT(" Connection not complete [%d]\n"), - transport->id () )); + ACE_TEXT ("TAO (%P|%t) - TAO_Connector::wait_for_transport, ") + ACE_TEXT ("Connection not complete [%d] reset state to ") + ACE_TEXT ("LFS_CONNECTION_WAIT\n"), transport->id ())); } transport->connection_handler ()->reset_state ( TAO_LF_Event::LFS_CONNECTION_WAIT); @@ -822,6 +823,12 @@ TAO_Connector::wait_for_connection_completion ( { transport->connection_handler ()-> reset_state (TAO_LF_Event::LFS_CONNECTION_WAIT); + if (TAO_debug_level > 9) + { + ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - TAO_Connector[%d]::" + "wait_for_connection_completion reset_state to " + "LFS_CONNECTION_WAIT\n", transport->id ())); + } result = 0; } } |