diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2009-02-17 14:04:16 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2009-02-17 14:04:16 +0000 |
commit | 34d2c5bd63f15c25cf5fd39b84ddb25c20601c6c (patch) | |
tree | 24b77cc87c3d13282e6128bc939b4b1403f45180 /TAO | |
parent | 94f3a741ffc5ad06c8cac7b3b852c4b4e1d341a2 (diff) | |
download | ATCD-34d2c5bd63f15c25cf5fd39b84ddb25c20601c6c.tar.gz |
Tue Feb 17 14:03:39 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl>
* orbsvcs/orbsvcs/HTIOP/HTIOP_Connector.cpp:
* orbsvcs/orbsvcs/PortableGroup/UIPMC_Connector.cpp:
* orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp:
* orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp:
* tao/Strategies/DIOP_Connector.cpp:
* tao/Strategies/SCIOP_Connector.cpp:
* tao/Strategies/SHMIOP_Connector.cpp:
* tao/Strategies/UIOP_Connector.cpp:
Only the return of -1 with cache_transport should be seen as an error
* tao/Cache_Entries_T.cpp:
Updated some debug statements
* tao/Condition.cpp:
* tao/Condition.h:
Changed delete_lock_ to a bool
* tao/Exception.cpp:
* tao/SystemException.cpp:
Check for self assignment in operator=
* tao/IIOP_Connection_Handler.cpp:
Layout changes to debug statements and use ACE_TEXT
* tao/IIOP_Connector.cpp:
Check the return value of cache_transport
* tao/Leader_Follower.inl:
Const change
* tao/LF_CH_Event.cpp:
* tao/LF_Event.h:
* tao/LF_Event.inl:
Addeds state_name to LF_Event and print the state as string instead
of number
* tao/Strategies/SCIOP_Acceptor.cpp:
Fixed gcc warning, don't use ACE_UNUSED_ARG anymore
* tao/Strategies/SCIOP_Connection_Handler.cpp:
Layout change
* tao/String_Alloc.cpp:
Simplified check
* tao/Transport_Cache_Manager_T.cpp:
* tao/Transport_Cache_Manager_T.h:
* tao/Transport_Cache_Manager_T.inl:
Updated various debug statements. When we have to purge the cache always try
to purge the cache with 1 entry else we don't purge when we have a very small
cache. Make the maximum transport cache size a real maximum, it was previously
not a real maximum, just a default allocation value. This fixes 3570
* tao/Transport_Connector.cpp:
Check the return value of cache_transport.
* tao/ZIOP/ZIOP.cpp:
* tao/ZIOP/ZIOP.h
Layout changes
* tests/Bug_3558_Regression/client.cpp:
* tests/Transport_Cache_Manager/Bug_3558_Regression.cpp:
The cache has now a real maximum, updated these tests
Diffstat (limited to 'TAO')
31 files changed, 420 insertions, 278 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 4f72a580c05..23e14a88b2d 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,69 @@ +Tue Feb 17 14:03:39 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl> + + * orbsvcs/orbsvcs/HTIOP/HTIOP_Connector.cpp: + * orbsvcs/orbsvcs/PortableGroup/UIPMC_Connector.cpp: + * orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp: + * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp: + * tao/Strategies/DIOP_Connector.cpp: + * tao/Strategies/SCIOP_Connector.cpp: + * tao/Strategies/SHMIOP_Connector.cpp: + * tao/Strategies/UIOP_Connector.cpp: + Only the return of -1 with cache_transport should be seen as an error + + * tao/Cache_Entries_T.cpp: + Updated some debug statements + + * tao/Condition.cpp: + * tao/Condition.h: + Changed delete_lock_ to a bool + + * tao/Exception.cpp: + * tao/SystemException.cpp: + Check for self assignment in operator= + + * tao/IIOP_Connection_Handler.cpp: + Layout changes to debug statements and use ACE_TEXT + + * tao/IIOP_Connector.cpp: + Check the return value of cache_transport + + * tao/Leader_Follower.inl: + Const change + + * tao/LF_CH_Event.cpp: + * tao/LF_Event.h: + * tao/LF_Event.inl: + Addeds state_name to LF_Event and print the state as string instead + of number + + * tao/Strategies/SCIOP_Acceptor.cpp: + Fixed gcc warning, don't use ACE_UNUSED_ARG anymore + + * tao/Strategies/SCIOP_Connection_Handler.cpp: + Layout change + + * tao/String_Alloc.cpp: + Simplified check + + * tao/Transport_Cache_Manager_T.cpp: + * tao/Transport_Cache_Manager_T.h: + * tao/Transport_Cache_Manager_T.inl: + Updated various debug statements. When we have to purge the cache always try + to purge the cache with 1 entry else we don't purge when we have a very small + cache. Make the maximum transport cache size a real maximum, it was previously + not a real maximum, just a default allocation value. This fixes 3570 + + * tao/Transport_Connector.cpp: + Check the return value of cache_transport. + + * tao/ZIOP/ZIOP.cpp: + * tao/ZIOP/ZIOP.h + Layout changes + + * tests/Bug_3558_Regression/client.cpp: + * tests/Transport_Cache_Manager/Bug_3558_Regression.cpp: + The cache has now a real maximum, updated these tests + Tue Feb 17 11:04:39 UTC 2009 Johnny Willemsen <jwillemsen@remedy.nl> * bin/tao_orb_tests.lst: diff --git a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Connector.cpp b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Connector.cpp index 3c95c01a99d..13b6d3a5fb2 100644 --- a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Connector.cpp +++ b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Connector.cpp @@ -268,7 +268,7 @@ TAO::HTIOP::Connector::make_connection (TAO::Profile_Transport_Resolver *, this->orb_core ()->lane_resources (). transport_cache ().cache_transport (&desc, transport); - if (retval != 0) + if (retval == -1) { svc_handler->close(); if (TAO_debug_level > 0) diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connector.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connector.cpp index f7c6fa79081..04607ce719e 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connector.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/UIPMC_Connector.cpp @@ -191,7 +191,7 @@ TAO_UIPMC_Connector::make_connection (TAO::Profile_Transport_Resolver *, transport); // Failure in adding to cache. - if (retval != 0) + if (retval == -1) { // Close the handler (this will also delete svc_handler). svc_handler->close (); diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp index e837588c2a5..f04309b4f70 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/IIOP_SSL_Connector.cpp @@ -234,7 +234,7 @@ TAO::IIOP_SSL_Connector::make_connection ( transport); // Failure in adding to cache. - if (retval != 0) + if (retval == -1) { // Close the handler. svc_handler->close (); diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp index 9ab3b65d5b5..68ea93b65d9 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp @@ -728,7 +728,7 @@ TAO::SSLIOP::Connector::ssliop_connect ( transport); // Failure in adding to cache. - if (retval != 0) + if (retval == -1) { // Close the handler. svc_handler->close (); diff --git a/TAO/tao/Cache_Entries_T.cpp b/TAO/tao/Cache_Entries_T.cpp index d3bc16f67b0..21a9d765af6 100644 --- a/TAO/tao/Cache_Entries_T.cpp +++ b/TAO/tao/Cache_Entries_T.cpp @@ -23,9 +23,10 @@ namespace TAO this->is_connected_ = transport->is_connected(); transport->add_reference (); if (TAO_debug_level > 9) - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Cache_IntId_T::Cache_IntId_T") - ACE_TEXT (" this=%d Transport[%d] is%Cconnected\n"), this, - transport->id (), (is_connected_ ? " " : " not "))); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - Cache_IntId_T::Cache_IntId_T, ") + ACE_TEXT ("this=%@ Transport[%d] is%Cconnected\n"), + this, transport->id (), (is_connected_ ? " " : " not "))); } template <typename TRANSPORT_TYPE> @@ -61,7 +62,7 @@ namespace TAO { if (TAO_debug_level > 9) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Cache_IntId_T::") - ACE_TEXT ("recycle_state %C->%C Transport=%d IntId=%d\n"), + ACE_TEXT ("recycle_state, %C->%C Transport[%d] IntId=%@\n"), state_name (recycle_state_), state_name (st), transport_ ? transport_->id() : 0, this)); this->recycle_state_ = st; diff --git a/TAO/tao/Condition.cpp b/TAO/tao/Condition.cpp index 09f7cb1b5b2..652e83f3265 100644 --- a/TAO/tao/Condition.cpp +++ b/TAO/tao/Condition.cpp @@ -16,7 +16,7 @@ template <class MUTEX> TAO_Condition<MUTEX>::TAO_Condition (MUTEX &m) : mutex_ (&m), - delete_lock_ (0), + delete_lock_ (false), cond_ (0) { // @todo: Need to add the allocatore here.. @@ -27,7 +27,7 @@ TAO_Condition<MUTEX>::TAO_Condition (MUTEX &m) template <class MUTEX> TAO_Condition<MUTEX>::TAO_Condition (void) : mutex_ (0), - delete_lock_ (0), + delete_lock_ (false), cond_ (0) { @@ -36,7 +36,7 @@ TAO_Condition<MUTEX>::TAO_Condition (void) ACE_NEW (this->mutex_, MUTEX); - this->delete_lock_ = 1; + this->delete_lock_ = true; ACE_NEW (this->cond_, TAO_SYNCH_CONDITION (*this->mutex_)); diff --git a/TAO/tao/Condition.h b/TAO/tao/Condition.h index 5a1d1bada70..5743b15928a 100644 --- a/TAO/tao/Condition.h +++ b/TAO/tao/Condition.h @@ -36,7 +36,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL * @brief Same as to the ACE_Condition variable wrapper * * This class differs from ACE_Condition in that it uses a - * TAO_SYNCH_CONDITION instead of ACE_cond_t under the hood to + * TAO_SYNCH_CONDITION instead of ACE_cond_t under the hood to * provide blocking. */ template <class MUTEX> @@ -99,7 +99,7 @@ private: MUTEX *mutex_; /// A flag to indicate whether the lock needs to be deleted. - int delete_lock_; + bool delete_lock_; /// Condition variable. TAO_SYNCH_CONDITION *cond_; diff --git a/TAO/tao/Exception.cpp b/TAO/tao/Exception.cpp index 455c144106c..5d648d011f8 100644 --- a/TAO/tao/Exception.cpp +++ b/TAO/tao/Exception.cpp @@ -66,11 +66,14 @@ CORBA::Exception::~Exception (void) CORBA::Exception & CORBA::Exception::operator= (const CORBA::Exception &src) { - this->id_ = CORBA::string_dup (src.id_); - ACE_ASSERT (this->id_.in () != 0); - - this->name_ = CORBA::string_dup (src.name_); - ACE_ASSERT (this->name_.in () != 0); + if (this != &src) + { + this->id_ = CORBA::string_dup (src.id_); + ACE_ASSERT (this->id_.in () != 0); + + this->name_ = CORBA::string_dup (src.name_); + ACE_ASSERT (this->name_.in () != 0); + } return *this; } diff --git a/TAO/tao/IIOP_Connection_Handler.cpp b/TAO/tao/IIOP_Connection_Handler.cpp index 23fbdfa0062..30e21eb609c 100644 --- a/TAO/tao/IIOP_Connection_Handler.cpp +++ b/TAO/tao/IIOP_Connection_Handler.cpp @@ -30,8 +30,10 @@ 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)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("TAO (%P|%t) - IIOP_Connection_Handler[%d]::") + ACE_TEXT("add_reference, up to %d\n"), + this->transport (), rc)); } return rc; @@ -44,8 +46,9 @@ TAO_IIOP_Connection_Handler::remove_reference (void) 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)); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("TAO (%P|%t) - IIOP_Connection_Handler[%d]::") + ACE_TEXT("remove_reference, down to %d\n"), tport, rc)); } return rc; } @@ -78,8 +81,9 @@ TAO_IIOP_Connection_Handler::TAO_IIOP_Connection_Handler ( if (TAO_debug_level > 9) { - ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - IIOP_Connection_Handler[%d] ctor, " - "this = %d\n", + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("TAO (%P|%t) - IIOP_Connection_Handler[%d] ctor, ") + ACE_TEXT("this=%@\n"), static_cast<TAO_Transport *> (specific_transport), this)); } @@ -567,8 +571,8 @@ TAO_IIOP_Connection_Handler::set_tos (int tos) if (TAO_debug_level) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - IIOP_Connection_Handler::" - "set_dscp_codepoint -> IPV6_TCLASS not supported yet\n")); + ACE_TEXT("TAO (%P|%t) - IIOP_Connection_Handler::") + ACE_TEXT("set_dscp_codepoint -> IPV6_TCLASS not supported yet\n"))); } return 0; } @@ -588,8 +592,8 @@ TAO_IIOP_Connection_Handler::set_tos (int tos) if (TAO_debug_level) { ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - IIOP_Connection_Handler::" - "set_dscp_codepoint -> dscp: %x; result: %d; %s\n", + ACE_TEXT("TAO (%P|%t) - IIOP_Connection_Handler::") + ACE_TEXT("set_dscp_codepoint -> dscp: %x; result: %d; %C\n"), tos, result, result == -1 ? "try running as superuser" : "")); @@ -659,8 +663,6 @@ TAO_IIOP_Connection_Handler::abort (void) } } - - //@@ CONNECTION_HANDLER_SPL_COPY_HOOK_END /* * End copy hook diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index 04249dc5875..477ef3e9443 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -438,14 +438,19 @@ TAO_IIOP_Connector::complete_connection (int result, if (result != -1) { - // We received a compeleted connection and 0 or more pending. + // We received a completed connection and 0 or more pending. // the winner is the last member of the list, because the // iterator stopped on a successful connect. transport = tlist[count-1]; desc.reset_endpoint (ep_list[count-1]); TAO::Transport_Cache_Manager &tcm = this->orb_core ()->lane_resources ().transport_cache (); - tcm.cache_transport (&desc, transport); + if (tcm.cache_transport (&desc, transport) == -1) + { + // Cache is full, so close the connection again + sh_list[count-1]->close (); + transport = 0; + } } else { @@ -593,7 +598,7 @@ TAO_IIOP_Connector::complete_connection (int result, } // Failure in adding to cache - if (retval != 0) + if (retval == -1) { // Close the handler. svc_handler->close (); diff --git a/TAO/tao/LF_CH_Event.cpp b/TAO/tao/LF_CH_Event.cpp index ad843e27ffd..85d7175b890 100644 --- a/TAO/tao/LF_CH_Event.cpp +++ b/TAO/tao/LF_CH_Event.cpp @@ -49,9 +49,12 @@ TAO_LF_CH_Event::state_changed_i (int new_state) { 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_)); + "state_changed_i, state %C->%C\n", + id, + TAO_LF_Event::state_name(prev_state_), + TAO_LF_Event::state_name(state_))); } } @@ -145,7 +148,7 @@ TAO_LF_CH_Event::set_state (int new_state) { id = ch->transport ()->id (); } - ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - TAO_LF_CH_Event[%d]::set_state " + 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/LF_Event.h b/TAO/tao/LF_Event.h index 937a504ae16..3e41fd689ee 100644 --- a/TAO/tao/LF_Event.h +++ b/TAO/tao/LF_Event.h @@ -124,6 +124,8 @@ public: /// Reset the state, irrespective of the previous states void reset_state (int new_state); + static const char *state_name (int st); + protected: /// Validate the state change diff --git a/TAO/tao/LF_Event.inl b/TAO/tao/LF_Event.inl index 60ec3ca2cf6..569307442a8 100644 --- a/TAO/tao/LF_Event.inl +++ b/TAO/tao/LF_Event.inl @@ -34,4 +34,22 @@ TAO_LF_Event::keep_waiting (void) return (this->successful () == 0) && (this->error_detected () == 0); } +ACE_INLINE const char * +TAO_LF_Event::state_name (int st) +{ +#define TAO_LF_EVENT_ENTRY(X) case X: return #X + switch (st) + { + TAO_LF_EVENT_ENTRY (LFS_IDLE); + TAO_LF_EVENT_ENTRY (LFS_ACTIVE); + TAO_LF_EVENT_ENTRY (LFS_CONNECTION_WAIT); + TAO_LF_EVENT_ENTRY (LFS_SUCCESS); + TAO_LF_EVENT_ENTRY (LFS_FAILURE); + TAO_LF_EVENT_ENTRY (LFS_TIMEOUT); + TAO_LF_EVENT_ENTRY (LFS_CONNECTION_CLOSED); + } + return "***Unknown enum value, update TAO_LF_Event::state_name()"; +#undef TAO_CACHE_INTID_ENTRY +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Leader_Follower.inl b/TAO/tao/Leader_Follower.inl index f37256b9d52..60293532455 100644 --- a/TAO/tao/Leader_Follower.inl +++ b/TAO/tao/Leader_Follower.inl @@ -74,7 +74,7 @@ TAO_Leader_Follower::set_event_loop_thread (ACE_Time_Value *max_wait_time) if (this->client_thread_is_leader_ && tss->client_leader_thread_ == 0) { - int const result = + int result = this->wait_for_client_leader_to_complete (max_wait_time); if (result != 0) diff --git a/TAO/tao/Strategies/DIOP_Connector.cpp b/TAO/tao/Strategies/DIOP_Connector.cpp index f2c227a73ed..86d47f8cce8 100644 --- a/TAO/tao/Strategies/DIOP_Connector.cpp +++ b/TAO/tao/Strategies/DIOP_Connector.cpp @@ -197,7 +197,7 @@ TAO_DIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *, transport); // Failure in adding to cache. - if (retval != 0) + if (retval == -1) { // Close the handler (this will also delete svc_handler). svc_handler->close (); diff --git a/TAO/tao/Strategies/SCIOP_Acceptor.cpp b/TAO/tao/Strategies/SCIOP_Acceptor.cpp index 34ddf5630b9..13256d30d65 100644 --- a/TAO/tao/Strategies/SCIOP_Acceptor.cpp +++ b/TAO/tao/Strategies/SCIOP_Acceptor.cpp @@ -213,8 +213,8 @@ TAO_SCIOP_Acceptor::close (void) int TAO_SCIOP_Acceptor::open (TAO_ORB_Core *orb_core, ACE_Reactor *reactor, - int major, - int minor, + int, + int, const char *address, const char *options) { @@ -235,9 +235,6 @@ TAO_SCIOP_Acceptor::open (TAO_ORB_Core *orb_core, if (address == 0) return -1; - ACE_UNUSED_ARG (major); - ACE_UNUSED_ARG (minor); - // Parse options if (this->parse_options (options) == -1) return -1; @@ -385,7 +382,10 @@ TAO_SCIOP_Acceptor::open (TAO_ORB_Core *orb_core, primary_ip_addr, 1, secondary_ip_addrs, - num_secondary_ip_addrs)); + num_secondary_ip_addrs) != 0) + { + return -1; + } // Number of endpoints equals the size of the hostname array. this->endpoint_count_ = hostnames.size(); @@ -452,8 +452,8 @@ TAO_SCIOP_Acceptor::open (TAO_ORB_Core *orb_core, int TAO_SCIOP_Acceptor::open_default (TAO_ORB_Core *orb_core, ACE_Reactor *reactor, - int major, - int minor, + int, + int, const char *options) { this->orb_core_ = orb_core; @@ -469,10 +469,6 @@ TAO_SCIOP_Acceptor::open_default (TAO_ORB_Core *orb_core, -1); } - - ACE_UNUSED_ARG (major); - ACE_UNUSED_ARG (minor); - // Parse options if (this->parse_options (options) == -1) return -1; @@ -892,7 +888,7 @@ TAO_SCIOP_Acceptor::object_key (IOP::TaggedProfile &profile, { if (TAO_debug_level > 0) { - ACE_DEBUG ((LM_DEBUG, + ACE_ERROR ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) SCIOP_Profile::decode - v%d.%d\n"), major, minor)); @@ -917,7 +913,7 @@ TAO_SCIOP_Acceptor::object_key (IOP::TaggedProfile &profile, } // ... and object key. - if ((cdr >> object_key) == 0) + if (!(cdr >> object_key)) return -1; // We are NOT bothered about the rest. diff --git a/TAO/tao/Strategies/SCIOP_Connection_Handler.cpp b/TAO/tao/Strategies/SCIOP_Connection_Handler.cpp index a961f65fb0e..8ab30b5f351 100644 --- a/TAO/tao/Strategies/SCIOP_Connection_Handler.cpp +++ b/TAO/tao/Strategies/SCIOP_Connection_Handler.cpp @@ -356,7 +356,6 @@ TAO_SCIOP_Connection_Handler::add_transport_to_cache (void) // Idle the transport.. return cache.cache_transport (&prop, this->transport ()); - } int diff --git a/TAO/tao/Strategies/SCIOP_Connector.cpp b/TAO/tao/Strategies/SCIOP_Connector.cpp index df9ec10f621..7ac0d27bdcc 100644 --- a/TAO/tao/Strategies/SCIOP_Connector.cpp +++ b/TAO/tao/Strategies/SCIOP_Connector.cpp @@ -286,7 +286,7 @@ TAO_SCIOP_Connector::make_connection_i (TAO::Profile_Transport_Resolver *r, transport); // Failure in adding to cache. - if (retval != 0) + if (retval == -1) { // Close the handler. svc_handler->close (); diff --git a/TAO/tao/Strategies/SHMIOP_Connector.cpp b/TAO/tao/Strategies/SHMIOP_Connector.cpp index 5e8aed3cf36..fc29ec9bac3 100644 --- a/TAO/tao/Strategies/SHMIOP_Connector.cpp +++ b/TAO/tao/Strategies/SHMIOP_Connector.cpp @@ -218,7 +218,7 @@ TAO_SHMIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *, transport); // Failure in adding to cache. - if (retval != 0) + if (retval == -1) { // Close the handler. svc_handler->close (); diff --git a/TAO/tao/Strategies/UIOP_Connector.cpp b/TAO/tao/Strategies/UIOP_Connector.cpp index 5cb31588297..4dd6e874962 100644 --- a/TAO/tao/Strategies/UIOP_Connector.cpp +++ b/TAO/tao/Strategies/UIOP_Connector.cpp @@ -258,7 +258,7 @@ TAO_UIOP_Connector::make_connection (TAO::Profile_Transport_Resolver *r, this->orb_core ()->lane_resources ().transport_cache ().cache_transport (&desc, transport); // Failure in adding to cache. - if (retval != 0) + if (retva l== -1) { // Close the handler. svc_handler->close (); diff --git a/TAO/tao/String_Alloc.cpp b/TAO/tao/String_Alloc.cpp index 57f211eadc9..fbf074ec369 100644 --- a/TAO/tao/String_Alloc.cpp +++ b/TAO/tao/String_Alloc.cpp @@ -27,7 +27,7 @@ CORBA::string_dup (const char *str) // This allocates an extra byte for the '\0'; char * copy = CORBA::string_alloc (static_cast<CORBA::ULong> (len)); - if (copy != 0) + if (copy) { // The memcpy() assumes that the destination is a valid buffer. ACE_OS::memcpy (copy, str, len + 1); diff --git a/TAO/tao/SystemException.cpp b/TAO/tao/SystemException.cpp index e1a56457208..79ddeff878c 100644 --- a/TAO/tao/SystemException.cpp +++ b/TAO/tao/SystemException.cpp @@ -101,10 +101,13 @@ CORBA::SystemException::~SystemException (void) CORBA::SystemException & CORBA::SystemException::operator= (const CORBA::SystemException &src) { - this->Exception::operator= (src); + if (this != &src) + { + this->Exception::operator= (src); - this->minor_ = src.minor_; - this->completed_ = src.completed_; + this->minor_ = src.minor_; + this->completed_ = src.completed_; + } return *this; } diff --git a/TAO/tao/Transport_Cache_Manager_T.cpp b/TAO/tao/Transport_Cache_Manager_T.cpp index e22348093b4..3c07f94bdb7 100644 --- a/TAO/tao/Transport_Cache_Manager_T.cpp +++ b/TAO/tao/Transport_Cache_Manager_T.cpp @@ -32,13 +32,18 @@ namespace TAO Transport_Cache_Manager_T<TT, TRDT, PSTRAT>::Transport_Cache_Manager_T ( int percent, purging_strategy* purging_strategy, - int cache_maximum, - int locked, + size_t cache_maximum, + bool locked, const char *orbid) : percent_ (percent) , purging_strategy_ (purging_strategy) , cache_map_ (cache_maximum) , cache_lock_ (0) + , cache_maximum_ (cache_maximum) +#if defined (TAO_HAS_MONITOR_POINTS) && (TAO_HAS_MONITOR_POINTS == 1) + , purge_monitor_ (0) + , size_monitor_ (0) +#endif /* TAO_HAS_MONITOR_POINTS==1 */ { if (locked) { @@ -108,13 +113,14 @@ namespace TAO template <typename TT, typename TRDT, typename PSTRAT> int - Transport_Cache_Manager_T<TT, TRDT, PSTRAT>::bind_i (Cache_ExtId &ext_id, - Cache_IntId &int_id) + Transport_Cache_Manager_T<TT, TRDT, PSTRAT>::bind_i ( + Cache_ExtId &ext_id, + Cache_IntId &int_id) { if (TAO_debug_level > 4) { ACE_DEBUG ((LM_INFO, - ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::bind_i: ") + ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::bind_i, ") ACE_TEXT ("Transport[%d] @ hash:index{%d:%d}\n"), int_id.transport ()->id (), ext_id.hash (), @@ -132,57 +138,71 @@ namespace TAO bool more_to_do = true; while (more_to_do) { - retval = this->cache_map_.bind (ext_id, int_id, entry); - if (retval == 0) + if (this->cache_map_.current_size () >= cache_maximum_) { - // The entry has been added to cache succesfully - // Add the cache_map_entry to the transport - int_id.transport ()->cache_map_entry (entry); + retval = -1; + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT("TAO (%P|%t) - Transport_Cache_Manager_T::bind_i, ") + ACE_TEXT("ERROR: unable to bind transport, cache is full\n"))); + } more_to_do = false; } - else if (retval == 1) + else { - if (entry->item ().transport () == int_id.transport ()) + retval = this->cache_map_.bind (ext_id, int_id, entry); + if (retval == 0) { - // update the cache status - // we are already holding the lock, do not call set_entry_state - entry->item ().recycle_state (int_id.recycle_state ()); - if (TAO_debug_level > 9 && - entry->item ().is_connected () != int_id.is_connected ()) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - Transport_Cache_") - ACE_TEXT ("Manager::bind_i: Updating existing ") - ACE_TEXT ("entry sets is_connected to %C\n"), - (int_id.is_connected () ? "true" : "false"))); - - entry->item ().is_connected (int_id.is_connected ()); - retval = 0; + // The entry has been added to cache succesfully + // Add the cache_map_entry to the transport + int_id.transport ()->cache_map_entry (entry); more_to_do = false; } - else - { - ext_id.index (ext_id.index () + 1); - if (TAO_debug_level > 8) + else if (retval == 1) + { + if (entry->item ().transport () == int_id.transport ()) + { + // update the cache status + // we are already holding the lock, do not call set_entry_state + entry->item ().recycle_state (int_id.recycle_state ()); + if (TAO_debug_level > 9 && + entry->item ().is_connected () != int_id.is_connected ()) + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - Transport_Cache_") + ACE_TEXT ("Manager::bind_i, Updating existing ") + ACE_TEXT ("entry sets is_connected to %C\n"), + (int_id.is_connected () ? "true" : "false"))); + + entry->item ().is_connected (int_id.is_connected ()); + retval = 0; + more_to_do = false; + } + else { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::bind_i: ") - ACE_TEXT ("Unable to bind Transport[%d] @ hash:index{%d:%d}. ") - ACE_TEXT ("Trying with a new index\n"), - int_id.transport ()->id (), - ext_id.hash (), - ext_id.index ())); + ext_id.index (ext_id.index () + 1); + if (TAO_debug_level > 8) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::bind_i, ") + ACE_TEXT ("Unable to bind Transport[%d] @ hash:index{%d:%d}. ") + ACE_TEXT ("Trying with a new index\n"), + int_id.transport ()->id (), + ext_id.hash (), + ext_id.index ())); + } } - } - } - else - { - if (TAO_debug_level > 0) + } + else { - ACE_ERROR ((LM_ERROR, - ACE_TEXT("TAO (%P|%t) - Transport_Cache_Manager_T::bind_i, ") - ACE_TEXT("ERROR: unable to bind transport\n"))); + if (TAO_debug_level > 0) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT("TAO (%P|%t) - Transport_Cache_Manager_T::bind_i, ") + ACE_TEXT("ERROR: unable to bind transport\n"))); + } + more_to_do = false; } - more_to_do = false; } } if (retval == 0) @@ -293,7 +313,7 @@ namespace TAO if (TAO_debug_level > 6) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::find_i: ") + ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::find_i, ") ACE_TEXT ("Found available Transport[%d] @hash:index {%d:%d}\n"), entry->item ().transport ()->id (), entry->ext_id_.hash (), @@ -306,7 +326,7 @@ namespace TAO if (TAO_debug_level > 6) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::find_i: ") + ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::find_i, ") ACE_TEXT ("Found connecting Transport[%d] @hash:index {%d:%d}\n"), entry->item ().transport ()->id (), entry->ext_id_.hash (), @@ -332,7 +352,7 @@ namespace TAO if (TAO_debug_level > 6) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::find_i: ") + ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::find_i, ") ACE_TEXT ("Found busy Transport[%d] @hash:index {%d:%d}\n"), entry->item ().transport ()->id (), entry->ext_id_.hash (), @@ -489,7 +509,7 @@ namespace TAO { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::") - ACE_TEXT ("is_entry_available_i[%d]: %C state is %C\n"), + ACE_TEXT ("is_entry_available_i[%d], %C state is %C\n"), entry.int_id_.transport () ? entry.int_id_.transport ()->id () : 0, (result ? "true" : "false"), Cache_IntId::state_name (entry_state))); @@ -512,7 +532,7 @@ namespace TAO { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::") - ACE_TEXT ("is_entry_purgable_i[%d]: %C state is %C\n"), + ACE_TEXT ("is_entry_purgable_i[%d], %C state is %C\n"), entry.int_id_.transport ()->id (), (result ? "true" : "false"), Cache_IntId::state_name (entry_state))); @@ -540,7 +560,7 @@ namespace TAO { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::") - ACE_TEXT ("is_entry_connecting_i[%d]: %C, state is %C\n"), + ACE_TEXT ("is_entry_connecting_i[%d], %C, state is %C\n"), entry.int_id_.transport () ? entry.int_id_.transport ()->id () : 0, (result ? "true" : "false"), Cache_IntId::state_name (entry_state))); @@ -590,13 +610,15 @@ namespace TAO if (sorted_set != 0) { // BEGIN FORMER close_entries - // Calculate the number of entries to purge - int const amount = (sorted_size * this->percent_) / 100; + // Calculate the number of entries to purge, when we have + // to purge try to at least to purge minimal of 1 entry + // which is needed if we have a very small cache maximum + int const amount = (sorted_size * this->percent_) / 100 + 1; if (TAO_debug_level > 4) { ACE_DEBUG ((LM_INFO, - ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::purge: ") + ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::purge, ") ACE_TEXT ("Trying to purge %d of %d cache entries\n"), amount, sorted_size)); @@ -628,7 +650,7 @@ namespace TAO { ACE_ERROR ((LM_ERROR, ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T") - ACE_TEXT ("::purge: Unable to add transport[%d] ") + ACE_TEXT ("::purge, Unable to add transport[%d] ") ACE_TEXT ("on the to-be-closed set, so ") ACE_TEXT ("it will not be purged\n"), transport->id ())); @@ -668,7 +690,7 @@ namespace TAO if (TAO_debug_level > 4) { ACE_DEBUG ((LM_INFO, - ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::purge: ") + ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::purge, ") ACE_TEXT ("Cache size after purging is [%d]\n"), this->current_size () )); @@ -735,7 +757,7 @@ namespace TAO if (TAO_debug_level > 6) { ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::fill_set_i: ") + ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T::fill_set_i, ") ACE_TEXT ("current_size = %d, cache_maximum = %d\n"), current_size, cache_maximum)); } diff --git a/TAO/tao/Transport_Cache_Manager_T.h b/TAO/tao/Transport_Cache_Manager_T.h index d40cdabdf5c..871f0a65d80 100644 --- a/TAO/tao/Transport_Cache_Manager_T.h +++ b/TAO/tao/Transport_Cache_Manager_T.h @@ -99,8 +99,8 @@ namespace TAO Transport_Cache_Manager_T ( int percent, purging_strategy* purging_strategy, - int cache_maximum, - int locked, + size_t cache_maximum, + bool locked, const char *orbid); /// Destructor @@ -259,6 +259,9 @@ namespace TAO /// The lock that is used by the cache map ACE_Lock *cache_lock_; + /// Maximum size of the cache + size_t cache_maximum_; + #if defined (TAO_HAS_MONITOR_POINTS) && (TAO_HAS_MONITOR_POINTS == 1) /// Connection cache purge monitor. ACE::Monitor_Control::Size_Monitor *purge_monitor_; diff --git a/TAO/tao/Transport_Cache_Manager_T.inl b/TAO/tao/Transport_Cache_Manager_T.inl index 5edf3120186..f0889bed24c 100644 --- a/TAO/tao/Transport_Cache_Manager_T.inl +++ b/TAO/tao/Transport_Cache_Manager_T.inl @@ -61,8 +61,9 @@ namespace TAO if (TAO_debug_level > 9 && state != entry->item ().is_connected ()) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager_T") - ACE_TEXT ("::mark_connected %C Transport=%d\n"), - (state ? "true" : "false"), entry->item ().transport ()->id () + ACE_TEXT ("::mark_connected, %s Transport[%d]\n"), + (state ? ACE_TEXT("true") : ACE_TEXT("false")), + entry->item ().transport ()->id () )); entry->item().is_connected (state); } diff --git a/TAO/tao/Transport_Connector.cpp b/TAO/tao/Transport_Connector.cpp index 8b0f3a5fb8e..c9d417415f4 100644 --- a/TAO/tao/Transport_Connector.cpp +++ b/TAO/tao/Transport_Connector.cpp @@ -731,8 +731,11 @@ TAO_Connector::wait_for_connection_completion ( { TAO::Transport_Cache_Manager &tcm = this->orb_core ()->lane_resources ().transport_cache (); - tcm.cache_transport (&desc, transport); - result = 0; + result = tcm.cache_transport (&desc, transport); + if (result == -1) + { + + } } else if (transport->connection_handler ()->is_timeout ()) { @@ -772,93 +775,96 @@ TAO_Connector::wait_for_connection_completion ( TAO::Transport_Cache_Manager &tcm = this->orb_core ()->lane_resources ().transport_cache (); - tcm.cache_transport (&desc, transport, TAO::ENTRY_CONNECTING); + result = tcm.cache_transport (&desc, transport, TAO::ENTRY_CONNECTING); - if (r->blocked_connect ()) + if (result != -1) { - if (TAO_debug_level > 2) + if (r->blocked_connect ()) { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("TAO (%P|%t) - Transport_Connector::") - ACE_TEXT("wait_for_connection_completion, ") - ACE_TEXT("going to wait for connection completion on ") - ACE_TEXT("transport[%d]\n"), - transport->id ())); - } + if (TAO_debug_level > 2) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("TAO (%P|%t) - Transport_Connector::") + ACE_TEXT("wait_for_connection_completion, ") + ACE_TEXT("going to wait for connection completion on ") + ACE_TEXT("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, - ACE_TEXT("TAO (%P|%t) - Transport_Connector::") - ACE_TEXT("wait_for_connection_completion, ") - ACE_TEXT("transport [%d], wait done result = %d\n"), - transport->id (), result)); - } + if (TAO_debug_level > 2) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("TAO (%P|%t) - Transport_Connector::") + ACE_TEXT("wait_for_connection_completion, ") + ACE_TEXT("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). + // 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) + if (result == -1) { - 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) + if (errno == ETIME) { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("TAO (%P|%t) - Transport_Connector::") - ACE_TEXT("wait_for_connection_completion, ") - ACE_TEXT("transport [%d], Connection timed out.\n"), - transport->id ())); + 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, + ACE_TEXT("TAO (%P|%t) - Transport_Connector::") + ACE_TEXT("wait_for_connection_completion, ") + ACE_TEXT("transport [%d], Connection timed out.\n"), + transport->id ())); + } } - } - else - { - // The wait failed for some other reason. - // Report that making the connection failed - if (TAO_debug_level > 2) + else { - ACE_ERROR ((LM_ERROR, - ACE_TEXT("TAO (%P|%t) - Transport_Connector::") - ACE_TEXT("wait_for_connection_completion, ") - ACE_TEXT("transport [%d], wait for completion failed") - ACE_TEXT(" (%d) %p\n"), - transport->id (), errno, ACE_TEXT(""))); + // The wait failed for some other reason. + // Report that making the connection failed + if (TAO_debug_level > 2) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT("TAO (%P|%t) - Transport_Connector::") + ACE_TEXT("wait_for_connection_completion, ") + ACE_TEXT("transport [%d], wait for completion failed") + ACE_TEXT(" (%d) %p\n"), + transport->id (), errno, ACE_TEXT(""))); + } + 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); - transport->purge_entry (); } } - } - else //non-blocked connect (based on invocation, not connect strategy) - { - transport->connection_handler ()-> - reset_state (TAO_LF_Event::LFS_CONNECTION_WAIT); - if (TAO_debug_level > 9) + else //non-blocked connect (based on invocation, not connect strategy) { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT("TAO (%P|%t) - TAO_Connector[%d]::") - ACE_TEXT("wait_for_connection_completion reset_state to ") - ACE_TEXT("LFS_CONNECTION_WAIT\n"), transport->id ())); + transport->connection_handler ()-> + reset_state (TAO_LF_Event::LFS_CONNECTION_WAIT); + if (TAO_debug_level > 9) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT("TAO (%P|%t) - TAO_Connector[%d]::") + ACE_TEXT("wait_for_connection_completion reset_state to ") + ACE_TEXT("LFS_CONNECTION_WAIT\n"), transport->id ())); + } + result = 0; } - result = 0; } } diff --git a/TAO/tao/ZIOP/ZIOP.cpp b/TAO/tao/ZIOP/ZIOP.cpp index 0ada145378a..910811b7fc9 100644 --- a/TAO/tao/ZIOP/ZIOP.cpp +++ b/TAO/tao/ZIOP/ZIOP.cpp @@ -115,7 +115,7 @@ TAO_ZIOP_Loader::decompress (Compression::Compressor_ptr compressor, } catch (::Compression::CompressionException &e) { - ACE_ERROR_RETURN((LM_ERROR, + ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("Decompression failed: %C\n"), e._info ().c_str ()), false); @@ -125,7 +125,7 @@ TAO_ZIOP_Loader::decompress (Compression::Compressor_ptr compressor, } bool -TAO_ZIOP_Loader::decompress (ACE_Data_Block **db, TAO_Queued_Data& qd, +TAO_ZIOP_Loader::decompress (ACE_Data_Block **db, TAO_Queued_Data& qd, TAO_ORB_Core& orb_core) { CORBA::Object_var compression_manager = @@ -153,27 +153,27 @@ TAO_ZIOP_Loader::decompress (ACE_Data_Block **db, TAO_Queued_Data& qd, if (!(cdr >> data)) return false; - - Compression::Compressor_var compressor = + + Compression::Compressor_var compressor = manager->get_compressor (data.compressorid, 6); CORBA::OctetSeq myout; myout.length (data.original_length); if (decompress(compressor.in(), data.data, myout)) { - ACE_Message_Block *mb = new ACE_Message_Block(); - - mb->size ((size_t)(data.original_length + + ACE_Message_Block *mb = new ACE_Message_Block(); + + mb->size ((size_t)(data.original_length + TAO_GIOP_MESSAGE_HEADER_LEN)); - + qd.msg_block ()->rd_ptr (initial_rd_ptr); - - mb->copy(qd.msg_block ()->base () + begin, + + mb->copy(qd.msg_block ()->base () + begin, TAO_GIOP_MESSAGE_HEADER_LEN); - if (mb->copy((char*)myout.get_buffer(true), + if (mb->copy((char*)myout.get_buffer(true), (size_t)data.original_length) != 0) - ACE_ERROR_RETURN((LM_ERROR, + ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("TAO - (%P|%t) - ") ACE_TEXT ("Failed to copy decompressed data : ") ACE_TEXT ("Buffer too small\n")), @@ -226,7 +226,7 @@ TAO_ZIOP_Loader::compress (Compression::Compressor_ptr compressor, } catch (::Compression::CompressionException &e) { - ACE_ERROR_RETURN((LM_ERROR, + ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT ("Compression failed: %C\n"), e._info ().c_str ()), false); @@ -254,13 +254,13 @@ TAO_ZIOP_Loader::check_min_ratio (::Compression::CompressionRatio ratio, bool TAO_ZIOP_Loader::get_compressor_details ( ::Compression::CompressorIdLevelList *list, - Compression::CompressorId &compressor_id, + Compression::CompressorId &compressor_id, Compression::CompressionLevel &compression_level) { if (list) { - compressor_id = (*list)[0].compressor_id; + compressor_id = (*list)[0].compressor_id; compression_level = (*list)[0].compression_level; } else @@ -278,7 +278,7 @@ bool TAO_ZIOP_Loader::get_compression_details( CORBA::Policy_ptr compression_enabling_policy, CORBA::Policy_ptr compression_level_list_policy, - Compression::CompressorId &compressor_id, + Compression::CompressorId &compressor_id, Compression::CompressionLevel &compression_level) { bool use_ziop = false; @@ -301,12 +301,12 @@ TAO_ZIOP_Loader::get_compression_details( } else { - ACE_ERROR((LM_ERROR, + ACE_ERROR((LM_ERROR, ACE_TEXT("TAO (%P|%t) - ") ACE_TEXT("TAO_ZIOP_Loader::get_compression_details : ") ACE_TEXT("compression_enabling_policy is NIL. No ZIOP\n"))); } - + if (use_ziop) { if (!CORBA::is_nil (compression_level_list_policy)) @@ -316,13 +316,13 @@ TAO_ZIOP_Loader::get_compression_details( if (!CORBA::is_nil (srp.in ())) { - use_ziop = get_compressor_details (srp->compressor_ids (), + use_ziop = get_compressor_details (srp->compressor_ids (), compressor_id, compression_level); } } else { - ACE_ERROR((LM_ERROR, + ACE_ERROR((LM_ERROR, ACE_TEXT("TAO (%P|%t) - ") ACE_TEXT("TAO_ZIOP_Loader::get_compression_details : ") ACE_TEXT("Compression level policy not found\n"))); @@ -333,10 +333,10 @@ TAO_ZIOP_Loader::get_compression_details( void TAO_ZIOP_Loader::complete_compression (Compression::Compressor_ptr compressor, - TAO_OutputCDR &cdr, + TAO_OutputCDR &cdr, ACE_Message_Block& mb, - char *initial_rd_ptr, - CORBA::ULong low_value, + char *initial_rd_ptr, + CORBA::ULong low_value, CORBA::Long min_ratio, CORBA::ULong original_data_length, Compression::CompressorId compressor_id) @@ -349,9 +349,9 @@ TAO_ZIOP_Loader::complete_compression (Compression::Compressor_ptr compressor, bool compressed = this->compress (compressor, input, myout); - if (compressed && + if (compressed && (myout.length () < original_data_length) && - (this->check_min_ratio (compressor->compression_ratio(), + (this->check_min_ratio (compressor->compression_ratio(), min_ratio))) { mb.wr_ptr (mb.rd_ptr ()); @@ -363,8 +363,8 @@ TAO_ZIOP_Loader::complete_compression (Compression::Compressor_ptr compressor, cdr << data; mb.rd_ptr(initial_rd_ptr); int begin = (mb.rd_ptr() - mb.base ()); - mb.data_block ()->base ()[0 + begin] = 0x5A; - mb.data_block ()->base ()[TAO_GIOP_MESSAGE_SIZE_OFFSET + begin] = + mb.data_block ()->base ()[0 + begin] = 0x5A; + mb.data_block ()->base ()[TAO_GIOP_MESSAGE_SIZE_OFFSET + begin] = cdr.length() - TAO_GIOP_MESSAGE_HEADER_LEN; } } @@ -379,24 +379,24 @@ TAO_ZIOP_Loader::complete_compression (Compression::Compressor_ptr compressor, } bool -TAO_ZIOP_Loader::compress_data (TAO_OutputCDR &cdr, +TAO_ZIOP_Loader::compress_data (TAO_OutputCDR &cdr, CORBA::Object_ptr compression_manager, CORBA::ULong low_value, CORBA::Long min_ratio, - Compression::CompressorId compressor_id, + Compression::CompressorId compressor_id, Compression::CompressionLevel compression_level) { cdr.consolidate (); - + ACE_Message_Block* current = const_cast <ACE_Message_Block*> (cdr.current ()); char* initial_rd_ptr = current->rd_ptr(); // Set the read pointer to the point where the data starts current->rd_ptr (TAO_GIOP_MESSAGE_HEADER_LEN); - + current = const_cast <ACE_Message_Block*> (cdr.current()); - CORBA::ULong const original_data_length = + CORBA::ULong const original_data_length = (CORBA::ULong)(current->wr_ptr() - current->rd_ptr()); if (original_data_length > 0) @@ -406,12 +406,12 @@ TAO_ZIOP_Loader::compress_data (TAO_OutputCDR &cdr, if (!CORBA::is_nil(manager.in ())) { - Compression::Compressor_var compressor = + Compression::Compressor_var compressor = manager->get_compressor (compressor_id, compression_level); - - complete_compression(compressor.in (), cdr, *current, - initial_rd_ptr, low_value, min_ratio, - original_data_length, compressor_id); + + complete_compression(compressor.in (), cdr, *current, + initial_rd_ptr, low_value, min_ratio, + original_data_length, compressor_id); } } //set back read pointer in case no compression was done... @@ -430,14 +430,14 @@ TAO_ZIOP_Loader::marshal_data (TAO_OutputCDR &cdr, TAO_Stub& stub) CORBA::Boolean use_ziop = false; Compression::CompressorId compressor_id = Compression::COMPRESSORID_ZLIB; Compression::CompressionLevel compression_level = 0; - - CORBA::Policy_var compression_enabling_policy = + + CORBA::Policy_var compression_enabling_policy = stub.get_cached_policy (TAO_CACHED_COMPRESSION_ENABLING_POLICY); - CORBA::Policy_var compression_level_list_policy = + CORBA::Policy_var compression_level_list_policy = stub.get_cached_policy (TAO_CACHED_COMPRESSION_ID_LEVEL_LIST_POLICY); - - use_ziop = get_compression_details(compression_enabling_policy.in (), - compression_level_list_policy.in (), + + use_ziop = get_compression_details(compression_enabling_policy.in (), + compression_level_list_policy.in (), compressor_id, compression_level); if (use_ziop) @@ -445,19 +445,19 @@ TAO_ZIOP_Loader::marshal_data (TAO_OutputCDR &cdr, TAO_Stub& stub) CORBA::Object_var compression_manager = stub.orb_core ()->resolve_compression_manager(); - CORBA::Policy_var policy_low_value = + CORBA::Policy_var policy_low_value = stub.get_cached_policy (TAO_CACHED_COMPRESSION_LOW_VALUE_POLICY); - CORBA::Policy_var policy_min_ratio = + CORBA::Policy_var policy_min_ratio = stub.get_cached_policy (TAO_CACHED_MIN_COMPRESSION_RATIO_POLICY); - CORBA::ULong low_value = + CORBA::ULong low_value = this->compression_policy_value (policy_low_value.in ()); - CORBA::Long min_ratio = + CORBA::Long min_ratio = this->compression_policy_value (policy_min_ratio.in ()); - return compress_data(cdr, compression_manager.in (), + return compress_data(cdr, compression_manager.in (), low_value, min_ratio, - compressor_id, compression_level); + compressor_id, compression_level); } return false; #endif @@ -475,39 +475,39 @@ TAO_ZIOP_Loader::marshal_data (TAO_OutputCDR& cdr, TAO_ORB_Core& orb_core) Compression::CompressorId compressor_id = Compression::COMPRESSORID_ZLIB; Compression::CompressionLevel compression_level = 0; - CORBA::Policy_var compression_enabling_policy = - orb_core.get_cached_policy_including_current + CORBA::Policy_var compression_enabling_policy = + orb_core.get_cached_policy_including_current (TAO_CACHED_COMPRESSION_ENABLING_POLICY); - - CORBA::Policy_var compression_level_list_policy = - orb_core.get_cached_policy_including_current + + CORBA::Policy_var compression_level_list_policy = + orb_core.get_cached_policy_including_current (TAO_CACHED_COMPRESSION_ID_LEVEL_LIST_POLICY); - - use_ziop = get_compression_details(compression_enabling_policy.in (), - compression_level_list_policy.in (), + + use_ziop = get_compression_details(compression_enabling_policy.in (), + compression_level_list_policy.in (), compressor_id, compression_level); - + if (use_ziop) { CORBA::Object_var compression_manager = orb_core.resolve_compression_manager(); - - CORBA::Policy_var policy_low_value = - orb_core.get_cached_policy_including_current + + CORBA::Policy_var policy_low_value = + orb_core.get_cached_policy_including_current (TAO_CACHED_COMPRESSION_LOW_VALUE_POLICY); - - CORBA::Policy_var policy_min_ratio = - orb_core.get_cached_policy_including_current + + CORBA::Policy_var policy_min_ratio = + orb_core.get_cached_policy_including_current (TAO_CACHED_MIN_COMPRESSION_RATIO_POLICY); - CORBA::ULong low_value = + CORBA::ULong low_value = this->compression_policy_value (policy_low_value.in ()); - CORBA::Long min_ratio = + CORBA::Long min_ratio = this->compression_policy_value (policy_min_ratio.in ()); - - return compress_data(cdr, compression_manager.in (), + + return compress_data(cdr, compression_manager.in (), low_value, min_ratio, - compressor_id, compression_level); + compressor_id, compression_level); } return false; diff --git a/TAO/tao/ZIOP/ZIOP.h b/TAO/tao/ZIOP/ZIOP.h index 310117f45fb..f8639f3789e 100644 --- a/TAO/tao/ZIOP/ZIOP.h +++ b/TAO/tao/ZIOP/ZIOP.h @@ -72,34 +72,34 @@ private: bool get_compressor_details ( ::Compression::CompressorIdLevelList *list, - Compression::CompressorId &compressor_id, + Compression::CompressorId &compressor_id, Compression::CompressionLevel &compression_level); bool get_compression_details(CORBA::Policy_ptr compression_enabling_policy, CORBA::Policy_ptr compression_level_list_policy, - Compression::CompressorId &compressor_id, + Compression::CompressorId &compressor_id, Compression::CompressionLevel &compression_level); void complete_compression (Compression::Compressor_ptr compressor, - TAO_OutputCDR &cdr, + TAO_OutputCDR &cdr, ACE_Message_Block& mb, - char *initial_rd_ptr, - CORBA::ULong low_value, + char *initial_rd_ptr, + CORBA::ULong low_value, CORBA::Long min_ratio, CORBA::ULong original_data_length, Compression::CompressorId compressor_id); - bool compress_data (TAO_OutputCDR &cdr, + bool compress_data (TAO_OutputCDR &cdr, CORBA::Object_ptr compression_manager, CORBA::ULong low_value, CORBA::Long min_ratio, - ::Compression::CompressorId compressor_id, + ::Compression::CompressorId compressor_id, ::Compression::CompressionLevel compression_level); bool compress (Compression::Compressor_ptr compressor, const ::Compression::Buffer &source, ::Compression::Buffer &target); - + bool decompress (Compression::Compressor_ptr compressor, const ::Compression::Buffer &source, ::Compression::Buffer &target); diff --git a/TAO/tests/Bug_3558_Regression/client.cpp b/TAO/tests/Bug_3558_Regression/client.cpp index f039c4299fc..65631d8b69d 100644 --- a/TAO/tests/Bug_3558_Regression/client.cpp +++ b/TAO/tests/Bug_3558_Regression/client.cpp @@ -115,18 +115,22 @@ test_server (void *arg) ACE_TEXT ("%D (%P|%t) - string <%C> returned from server %d\n"), the_string.in (), server_nr)); } - catch (const CORBA::TRANSIENT &) + catch (const CORBA::TRANSIENT &e) { if (server_nr == 2) { ACE_DEBUG((LM_DEBUG, - ACE_TEXT ("%D Expected exception for server %d\n"), - server_nr)); + ACE_TEXT ("%D Expected exception for server %d: %C\n"), + server_nr, + e._info().c_str())); } else + { ACE_ERROR((LM_ERROR, - ACE_TEXT ("%D Unexpected exception for server %d\n"), - server_nr)); + ACE_TEXT ("%D Unexpected exception for server %d: %C\n"), + server_nr, + e._info().c_str())); + } } catch (...) { @@ -144,7 +148,15 @@ test_server (void *arg) server_nr)); if (!CORBA::is_nil(hello)) - hello->shutdown (); + { + try + { + hello->shutdown (); + } + catch (...) + { + } + } if (server_nr == 1) barrier.wait(); @@ -172,7 +184,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) ACE_TCHAR **extra = 0; ACE_NEW_RETURN (extra, ACE_TCHAR *[extra_argc], -1); extra[0] = ACE::strnew (ACE_TEXT ("-ORBSvcConfDirective")); - extra[1] = ACE::strnew (ACE_TEXT ("static Resource_Factory \"-ORBConnectionCacheMax 1\"")); + extra[1] = ACE::strnew (ACE_TEXT ("static Resource_Factory \"-ORBConnectionCacheMax 1 -ORBConnectionCachePurgePercentage 60\"")); extra[2] = ACE::strnew (ACE_TEXT ("-ORBSvcConfDirective")); extra[3] = ACE::strnew (ACE_TEXT ("static Client_Strategy_Factory \"-ORBTransportMuxStrategy EXCLUSIVE\"")); if (debug_level > 0) diff --git a/TAO/tests/Transport_Cache_Manager/Bug_3558_Regression.cpp b/TAO/tests/Transport_Cache_Manager/Bug_3558_Regression.cpp index aa17fbe25a6..ce9e3deb17c 100644 --- a/TAO/tests/Transport_Cache_Manager/Bug_3558_Regression.cpp +++ b/TAO/tests/Transport_Cache_Manager/Bug_3558_Regression.cpp @@ -48,7 +48,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[]) mytransport[i].purging_order (i); } - if (my_cache.current_size () != transport_max) + if (my_cache.current_size () != cache_maximum) { ACE_ERROR ((LM_ERROR, "ERROR Incorrect cache size %d\n", my_cache.current_size ())); ++result; |