diff options
author | Adam Mitz <mitza-oci@users.noreply.github.com> | 2008-08-26 22:26:35 +0000 |
---|---|---|
committer | Adam Mitz <mitza-oci@users.noreply.github.com> | 2008-08-26 22:26:35 +0000 |
commit | d94b3f0fce366c8c37c6916a61ed70474c68208a (patch) | |
tree | 4f2aba595b16521f43db6de31c7504d46710a366 | |
parent | 28b1fac48fc45e94b7deb11210a2e435d5b3bfe4 (diff) | |
download | ATCD-d94b3f0fce366c8c37c6916a61ed70474c68208a.tar.gz |
ChangeLogTag: Tue Aug 26 22:18:38 UTC 2008 Adam Mitz <mitza@ociweb.com>
-rw-r--r-- | TAO/ChangeLog | 14 | ||||
-rw-r--r-- | TAO/tao/Transport.cpp | 9 | ||||
-rw-r--r-- | TAO/tao/Transport_Connector.cpp | 200 |
3 files changed, 114 insertions, 109 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 3e9d454d27a..2d60006b007 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,15 @@ +Tue Aug 26 22:18:38 UTC 2008 Adam Mitz <mitza@ociweb.com> + + * tao/Transport.cpp (purge_entry): + + Use the handler_lock_ when changing state (cache_map_entry_). + + * tao/Transport_Connector.cpp (wait_for_connection_completion): + + Combine the blocked and non-blocked cases for the part where it + checks if the transport has already been connected, closed, or + timed-out. Previously the blocked connect didn't check these. + Mon Aug 25 22:28:04 UTC 2008 Adam Mitz <mitza@ociweb.com> * tao/LF_Event.h: @@ -11,7 +23,7 @@ Mon Aug 25 22:28:04 UTC 2008 Adam Mitz <mitza@ociweb.com> * tao/LF_Multi_Event.cpp: Modified for the new unbind() signature. - + * tao/LF_CH_Event.h: * tao/LF_CH_Event.cpp: diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp index bc7c10c71c3..5256ebea64e 100644 --- a/TAO/tao/Transport.cpp +++ b/TAO/tao/Transport.cpp @@ -488,9 +488,12 @@ TAO_Transport::purge_entry (void) // If there is only one reference count on us, we will end up causing // our own destruction. And we can not be holding a cache map entry if // that happens. - TAO::Transport_Cache_Manager::HASH_MAP_ENTRY* entry = this->cache_map_entry_; - this->cache_map_entry_ = 0; - + TAO::Transport_Cache_Manager::HASH_MAP_ENTRY* entry = 0; + { + ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1); + entry = this->cache_map_entry_; + this->cache_map_entry_ = 0; + } return this->transport_cache_manager ().purge_entry (entry); } diff --git a/TAO/tao/Transport_Connector.cpp b/TAO/tao/Transport_Connector.cpp index af155e47496..c5cf8ebf49c 100644 --- a/TAO/tao/Transport_Connector.cpp +++ b/TAO/tao/Transport_Connector.cpp @@ -560,9 +560,8 @@ TAO_Connector::connect (TAO::Profile_Transport_Resolver *r, if (TAO_debug_level > 2) { ACE_ERROR ((LM_ERROR, - "TAO (%P|%t) - Transport_Connector::connect, " - "wait for completion failed [%d]\n", - base_transport->id ())); + "TAO (%P|%t) - Transport_Connector::connect," + " wait for completion failed\n")); } return 0; } @@ -699,138 +698,129 @@ TAO_Connector::wait_for_connection_completion ( ACE_Time_Value *timeout) { int result = -1; - if (!r->blocked_connect ()) + if (transport->connection_handler ()->is_open ()) { - if (transport->connection_handler ()->is_open ()) - { - result = 0; - } - else if (transport->connection_handler ()->is_timeout ()) - { - if (TAO_debug_level > 2) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport_Connector::" - "wait_for_connection_completion, " - "transport [%d], Connection timed out.\n", - transport->id ())); - } - result = -1; - errno = ETIME; - } - else if (transport->connection_handler ()->is_closed ()) + result = 0; + } + else if (transport->connection_handler ()->is_timeout ()) + { + if (TAO_debug_level > 2) { - if (TAO_debug_level > 2) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport_Connector::" - "wait_for_connection_completion, " - "transport [%d], Connection failed. (%d) %p\n", - transport->id (), errno, "")); - } - result = -1; + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - Transport_Connector::" + "wait_for_connection_completion, " + "transport [%d], Connection timed out.\n", + transport->id ())); } - else + result = -1; + errno = ETIME; + } + else if (transport->connection_handler ()->is_closed ()) + { + if (TAO_debug_level > 2) { - if (TAO_debug_level > 2) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport_Connector::" - "wait_for_connection_completion, " - "transport [%d], Connection not complete.\n", - transport->id ())); - } - TAO::Transport_Cache_Manager &tcm = - this->orb_core ()->lane_resources ().transport_cache (); - tcm.cache_transport (&desc, transport, TAO::ENTRY_CONNECTING); - - transport->connection_handler ()-> - reset_state (TAO_LF_Event::LFS_CONNECTION_WAIT); - result = 0; + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - Transport_Connector::" + "wait_for_connection_completion, " + "transport [%d], Connection failed. (%d) %p\n", + transport->id (), errno, "")); } + result = -1; } else { - if (TAO_debug_level > 4) + if (TAO_debug_level > 2) { ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - Transport_Connector::" "wait_for_connection_completion, " - "caching before wait, hash %d = [%d]\n", - desc.hash(), + "transport [%d], Connection not complete.\n", transport->id ())); } + TAO::Transport_Cache_Manager &tcm = this->orb_core ()->lane_resources ().transport_cache (); tcm.cache_transport (&desc, transport, TAO::ENTRY_CONNECTING); - if (TAO_debug_level > 2) + + if (r->blocked_connect ()) { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport_Connector::" - "wait_for_connection_completion, " - "going to wait for connection completion on transport" - "[%d]\n", - transport->id ())); - } + if (TAO_debug_level > 2) + { + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - Transport_Connector::" + "wait_for_connection_completion, " + "going to wait for connection completion on " + "transport[%d]\n", + transport->id ())); + } - result = this->active_connect_strategy_->wait (transport, timeout); + result = this->active_connect_strategy_->wait (transport, timeout); - if (TAO_debug_level > 2) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport_Connector::" - "wait_for_connection_completion, " - "transport [%d], wait done result = %d\n", - transport->id (), result)); - } + if (TAO_debug_level > 2) + { + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - Transport_Connector::" + "wait_for_connection_completion, " + "transport [%d], wait done result = %d\n", + transport->id (), result)); + } - // There are three possibilities when wait() returns: (a) - // connection succeeded; (b) connection failed; (c) wait() - // failed because of some other error. It is easy to deal with - // (a) and (b). (c) is tricky since the connection is still - // pending and may get completed by some other thread. The - // following code deals with (c). - if (result == -1) - { - if (errno == ETIME) + // There are three possibilities when wait() returns: (a) + // connection succeeded; (b) connection failed; (c) wait() + // failed because of some other error. It is easy to deal with + // (a) and (b). (c) is tricky since the connection is still + // pending and may get completed by some other thread. The + // following code deals with (c). + + if (result == -1) { - if (timeout == 0) + if (errno == ETIME) { - // There was an error during connecting and the errno was - // ETIME. We didn't pass in a timeout, so there's - // something wrong with this transport. So, it must be - // purged. - transport->purge_entry (); - } + if (timeout == 0) + { + // There was an error during connecting and the errno was + // ETIME. We didn't pass in a timeout, so there's + // something wrong with this transport. So, it must be + // purged. + transport->purge_entry (); + } - if (TAO_debug_level > 2) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport_Connector::" - "wait_for_connection_completion, " - "transport [%d], Connection timed out.\n", - transport->id ())); + if (TAO_debug_level > 2) + { + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - Transport_Connector::" + "wait_for_connection_completion, " + "transport [%d], Connection timed out.\n", + transport->id ())); + } } - } - else - { - transport->purge_entry (); - // The wait failed for some other reason. - // Report that making the connection failed, don't print errno - // because we touched the reactor and errno could be changed - if (TAO_debug_level > 2) + else { - ACE_ERROR ((LM_ERROR, - "TAO (%P|%t) - Transport_Connector::" - "wait_for_connection_completion, " - "transport [%d], wait for completion failed (%d) %p\n", - transport->id (), errno, "")); + // The wait failed for some other reason. + // Report that making the connection failed + if (TAO_debug_level > 2) + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - Transport_Connector::" + "wait_for_connection_completion, " + "transport [%d], wait for completion failed" + " (%d) %p\n", + transport->id (), errno, "")); + } + TAO_Connection_Handler *con = + transport->connection_handler (); + result = this->check_connection_closure (con); + transport->purge_entry (); } - TAO_Connection_Handler *con = transport->connection_handler (); - result = this->check_connection_closure (con); } } + else //non-blocked connect (based on invocation, not connect strategy) + { + transport->connection_handler ()-> + reset_state (TAO_LF_Event::LFS_CONNECTION_WAIT); + result = 0; + } } if (result == -1) |