diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2008-05-30 13:21:24 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2008-05-30 13:21:24 +0000 |
commit | 04aa376a3f38ac7cd23fac9409f00ae2632238ff (patch) | |
tree | 75f3c312be49e8acef0ff1ce7e09553c6400bdd5 | |
parent | 849fbf1f25a77db253eb85cf83fe2562ff1f4ab9 (diff) | |
download | ATCD-04aa376a3f38ac7cd23fac9409f00ae2632238ff.tar.gz |
ChangeLogTag: Fri May 30 13:21:20 UTC 2008 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r-- | TAO/ChangeLog | 31 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp | 1 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp | 2 | ||||
-rw-r--r-- | TAO/tao/IIOP_Connector.cpp | 1 | ||||
-rw-r--r-- | TAO/tao/Strategies/SCIOP_Connector.cpp | 1 | ||||
-rw-r--r-- | TAO/tao/Strategies/UIOP_Connector.cpp | 1 | ||||
-rw-r--r-- | TAO/tao/Transport_Connector.cpp | 141 | ||||
-rw-r--r-- | TAO/tao/Transport_Connector.h | 1 |
8 files changed, 113 insertions, 66 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index e50da581c0f..26ce59ea44c 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,21 +1,46 @@ +Fri May 30 13:21:20 UTC 2008 Chad Elliott <elliott_c@ociweb.com> + + * tao/Transport_Connector.h: + * tao/Transport_Connector.cpp: + + Modified the connect() method to wait for the connection + completion if a transport is found but not connected. Also, fixed + a memory leak if a connection was found in the cache but had + previously experienced an error. + + This version of connect() is a hybrid of Dale's version and the + previous version. + + Also, the wait_for_connection_completion() method was changed to + not require the descriptor interface. + + * orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp: + * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp: + * tao/IIOP_Connector.cpp: + * tao/Strategies/SCIOP_Connector.cpp: + * tao/Strategies/UIOP_Connector.cpp: + + It is no longer necessary to pass in the descriptor interface to + wait_for_connection_completion(). + Fri May 30 13:04:00 UTC 2008 Simon Massey <sma@prismtech.com> * orbsvcs/tests/unit/Notify/MC/Statistic/Statistic.cpp: - + And again! Corrected for unsigned integer (size_t) ambiguity errors. Wed May 28 14:00:00 UTC 2008 Simon Massey <sma@prismtech.com> * orbsvcs/tests/unit/Notify/MC/NotificationServiceMonitor/NotificationServiceMonitor.cpp: * orbsvcs/tests/unit/Notify/MC/Statistic/Statistic.cpp: - + Corrected for unsigned integer (size_t) ambiguity errors. Tue May 27 13:34:12 UTC 2008 Jeff Parsons <j.parsons@vanderbilt.edu> * orbsvcs/orbsvcs/Notify/MonitorControl/Statistic.h: * orbsvcs/orbsvcs/Notify/MonitorControl/Statistic.cpp: - + Added implementation for the overload of receive() taking a size_t argument. Even though there is an implementation in the base class, we were getting warnings from some of diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp index 255287c37b9..f78387a27f5 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp @@ -180,7 +180,6 @@ TAO::IIOP_SSL_Connector::make_connection ( // get a connected transport or not. In case of non block we get // a connected or not connected transport if (!this->wait_for_connection_completion (r, - desc, transport, max_wait_time)) { diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp index 9ab3b65d5b5..b8d414172d4 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp @@ -519,7 +519,6 @@ TAO::SSLIOP::Connector::ssliop_connect ( if (!transport->is_connected()) { if (!this->wait_for_connection_completion (resolver, - *desc, transport, max_wait_time)) { @@ -663,7 +662,6 @@ TAO::SSLIOP::Connector::ssliop_connect ( // get a connected transport or not. In case of non block we get // a connected or not connected transport if (!this->wait_for_connection_completion (resolver, - *desc, transport, max_wait_time)) { diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index fe3c4b6c866..06e57baf14c 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -446,7 +446,6 @@ TAO_IIOP_Connector::complete_connection (int result, transport = tlist[0]; desc.reset_endpoint(ep_list[0]); if (!this->wait_for_connection_completion (r, - desc, transport, timeout)) { diff --git a/TAO/tao/Strategies/SCIOP_Connector.cpp b/TAO/tao/Strategies/SCIOP_Connector.cpp index c28b24bb4f7..d53f6abfa41 100644 --- a/TAO/tao/Strategies/SCIOP_Connector.cpp +++ b/TAO/tao/Strategies/SCIOP_Connector.cpp @@ -226,7 +226,6 @@ TAO_SCIOP_Connector::make_connection_i (TAO::Profile_Transport_Resolver *r, // get a connected transport or not. In case of non block we get // a connected or not connected transport if (!this->wait_for_connection_completion (r, - desc, transport, timeout)) { diff --git a/TAO/tao/Strategies/UIOP_Connector.cpp b/TAO/tao/Strategies/UIOP_Connector.cpp index 659bf8e2a1c..2af80adeeb9 100644 --- a/TAO/tao/Strategies/UIOP_Connector.cpp +++ b/TAO/tao/Strategies/UIOP_Connector.cpp @@ -202,7 +202,6 @@ TAO_UIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *r, // get a connected transport or not. In case of non block we get // a connected or not connected transport if (!this->wait_for_connection_completion (r, - desc, transport, max_wait_time)) { diff --git a/TAO/tao/Transport_Connector.cpp b/TAO/tao/Transport_Connector.cpp index 4d509f20da4..ff62ce2b3ad 100644 --- a/TAO/tao/Transport_Connector.cpp +++ b/TAO/tao/Transport_Connector.cpp @@ -27,6 +27,45 @@ ACE_RCSID (tao, Connector, "$Id$") +namespace +{ + class TransportCleanupGuard + { + public: + // Constructor. Initially assume that we're going to clean up the + // transport upon destruction. + TransportCleanupGuard (TAO_Transport *tp) + : tp_ (tp), + awake_ (true) + { + } + + ~TransportCleanupGuard () + { + if (this->awake_ && this->tp_) + { + // Purge from the connection cache. If we are not in the + // cache, this does nothing. + this->tp_->purge_entry (); + + // Close the handler and remove the reference. + this->tp_->close_connection (); + this->tp_->remove_reference (); + } + } + + /// Turn off the guard. + void clear () + { + this->awake_ = false; + } + + private: + TAO_Transport * const tp_; + bool awake_; + }; +} + TAO_BEGIN_VERSIONED_NAMESPACE_DECL // Connector @@ -438,6 +477,7 @@ TAO_Connector::connect (TAO::Profile_Transport_Resolver *r, TAO::Transport_Cache_Manager &tcm = this->orb_core ()->lane_resources ().transport_cache (); + // Stay in this loop until we find: // a usable connection, or a timeout happens while (true) @@ -464,7 +504,7 @@ TAO_Connector::connect (TAO::Profile_Transport_Resolver *r, } (void) base_transport->close_connection (); (void) base_transport->purge_entry (); - base_transport = 0; + base_transport->remove_reference (); } else { @@ -482,49 +522,51 @@ TAO_Connector::connect (TAO::Profile_Transport_Resolver *r, cr == TAO::TAO_CLIENT_ROLE ? "TAO_CLIENT_ROLE" : "TAO_UNSPECIFIED_ROLE" )); } - return base_transport; - } - } - else if (found == TAO::Transport_Cache_Manager::CACHE_FOUND_CONNECTING) - { - if (r->blocked_connect ()) - { - if (TAO_debug_level > 4) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("TAO (%P|%t) - Transport_Connector::waiting") - ACE_TEXT(" for connection on transport [%d]\n"), - base_transport->id ())); - } - // If wait_for_transport returns no errors, the base_transport - // points to the connection we wait for. - if (this->wait_for_transport (r, base_transport, timeout, false)) + // If connected return. + if (base_transport->is_connected ()) + return base_transport; + + // Is it possible to get a transport from the cache that is not + // connected? If not, then the following code is bogus. We cannot + // wait for a connection to complete on a transport in the cache. + // + // (mesnier_p@ociweb.com) It is indeed possible to reach this point. + // The AMI_Buffering test does. When using non-blocking connects and + // the first request(s) are asynch and may be queued, the connection + // establishment may not be completed by the time the invocation is + // done with it. In that case it is up to a subsequent invocation to + // handle the connection completion. + + TransportCleanupGuard tg(base_transport); + if (!this->wait_for_connection_completion (r, base_transport, timeout)) { - // be sure this transport is registered with the reactor - // before using it. - if (!base_transport->register_if_necessary ()) + if (TAO_debug_level > 2) { - base_transport->remove_reference (); - return 0; + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - Transport_Connector::connect, " + "wait for completion failed [%d]\n", + base_transport->id ())); } + return 0; } - // In either success or failure cases of wait_for_transport, the - // ref counter in corresponding to the ref counter added by - // find_transport is decremented. - base_transport->remove_reference (); - } - else - { - if (TAO_debug_level > 4) + if (base_transport->is_connected () && + base_transport->wait_strategy ()->register_handler () == -1) { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("TAO (%P|%t) - Transport_Connector::non-blocking: returning unconnected transport [%d]\n"), - base_transport->id ())); + // Registration failures. + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + "TAO (%P|%t) - Transport_Connector::connect, " + "could not register the transport [%d]" + "in the reactor.\n", + base_transport->id ())); + } + return 0; } - // return the transport in it's current, unconnected state + tg.clear (); return base_transport; } } @@ -540,7 +582,8 @@ TAO_Connector::connect (TAO::Profile_Transport_Resolver *r, if (make_new_connection) { - // we aren't going to use the transport returned from the cache (if any) + // we aren't going to use the transport returned from the cache + // (if any) if (base_transport != 0) { base_transport->remove_reference (); @@ -575,17 +618,16 @@ TAO_Connector::connect (TAO::Profile_Transport_Resolver *r, base_transport->id ())); } (void) base_transport->purge_entry (); + + base_transport->remove_reference (); } - // The new transport is in the cache. We'll pick it up from there - // next time thru this loop (using it from here causes more problems - // than it fixes due to the changes that allow a new connection to be - // re-used by a nested upcall before we get back here.) - base_transport->remove_reference (); + else + return base_transport; } else // not making new connection { - (void) this->wait_for_transport (r, base_transport, timeout, true); - base_transport->remove_reference (); + (void) this->wait_for_transport (r, base_transport, timeout, true); + base_transport->remove_reference (); } } } @@ -594,7 +636,6 @@ TAO_Connector::connect (TAO::Profile_Transport_Resolver *r, bool TAO_Connector::wait_for_connection_completion ( TAO::Profile_Transport_Resolver *r, - TAO_Transport_Descriptor_Interface& desc, TAO_Transport *&transport, ACE_Time_Value *timeout) { @@ -647,18 +688,6 @@ TAO_Connector::wait_for_connection_completion ( } else { - if (TAO_debug_level > 4) - { - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - Transport_Connector::" - "caching connection before wait_for_connection_completion " - "%d = [%d]\n", - desc.hash(), - 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) { ACE_DEBUG ((LM_DEBUG, diff --git a/TAO/tao/Transport_Connector.h b/TAO/tao/Transport_Connector.h index afa58ef7804..d509a911868 100644 --- a/TAO/tao/Transport_Connector.h +++ b/TAO/tao/Transport_Connector.h @@ -172,7 +172,6 @@ protected: */ virtual bool wait_for_connection_completion( TAO::Profile_Transport_Resolver *r, - TAO_Transport_Descriptor_Interface &desc, TAO_Transport *&transport, ACE_Time_Value *timeout); |