diff options
author | vzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-10-26 10:54:32 +0000 |
---|---|---|
committer | vzykov <vzykov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2009-10-26 10:54:32 +0000 |
commit | e8c1a7f4d5ebd2baa19e6dff7384a0394f9713f6 (patch) | |
tree | ae154a11f5203ce7f4a7782341aaa22e365c4d20 | |
parent | 09508d4279743b6034143ef9bf322d6b4273dcbd (diff) | |
download | ATCD-e8c1a7f4d5ebd2baa19e6dff7384a0394f9713f6.tar.gz |
Mon Oct 26 10:52:01 UTC 2009 Vladimir Zykov <vladimir.zykov@prismtech.com>
* orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor.cpp:
* orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor.h:
* orbsvcs/orbsvcs/HTIOP/HTIOP_Completion_Handler.cpp:
* orbsvcs/orbsvcs/HTIOP/HTIOP_Completion_Handler.h:
* orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.cpp:
* orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.h:
Fixed several memory leaks. Changed HTIOP Acceptor to use
strategies implemented in HTIOP_Acceptor_Impl.*. This was
required for proper fix for bug#3748.
* tao/Acceptor_Impl.cpp:
Uncommented code for a fix for bug#3748.
-rw-r--r-- | TAO/ChangeLog | 15 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor.cpp | 8 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor.h | 9 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.cpp | 257 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.h | 74 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Completion_Handler.cpp | 30 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Completion_Handler.h | 8 | ||||
-rw-r--r-- | TAO/tao/Acceptor_Impl.cpp | 2 |
8 files changed, 79 insertions, 324 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 4e55d4ceac6..0aa989c00e0 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,18 @@ +Mon Oct 26 10:52:01 UTC 2009 Vladimir Zykov <vladimir.zykov@prismtech.com> + + * orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor.cpp: + * orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor.h: + * orbsvcs/orbsvcs/HTIOP/HTIOP_Completion_Handler.cpp: + * orbsvcs/orbsvcs/HTIOP/HTIOP_Completion_Handler.h: + * orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.cpp: + * orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.h: + Fixed several memory leaks. Changed HTIOP Acceptor to use + strategies implemented in HTIOP_Acceptor_Impl.*. This was + required for proper fix for bug#3748. + + * tao/Acceptor_Impl.cpp: + Uncommented code for a fix for bug#3748. + Thu Oct 22 10:47:21 UTC 2009 Johnny Willemsen <jwilllemsen@remedy.nl> * TAO_IDL/TAO_IDL_ACE.mwc: diff --git a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor.cpp b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor.cpp index ebb5e92b171..d2015c7cc80 100644 --- a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor.cpp +++ b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor.cpp @@ -34,7 +34,7 @@ TAO::HTIOP::Acceptor::Acceptor (ACE::HTBP::Environment *ht_env, hostname_in_ior_ (0), version_ (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR), orb_core_ (0), - base_acceptor_ (), + base_acceptor_ (this), creation_strategy_ (0), concurrency_strategy_ (0), accept_strategy_ (0), @@ -456,7 +456,9 @@ TAO::HTIOP::Acceptor::open_default (TAO_ORB_Core *orb_core, sizeof (char*) * this->endpoint_count_); ACE::HTBP::ID_Requestor req(ht_env_); - this->addrs_[0] = ACE_TEXT_ALWAYS_CHAR(req.get_HTID()); + ACE_TCHAR *htid = req.get_HTID (); + ACE_Auto_Array_Ptr<ACE_TCHAR> guard (htid); + this->addrs_[0] = ACE_TEXT_ALWAYS_CHAR (htid); return 0; } @@ -488,7 +490,7 @@ TAO::HTIOP::Acceptor::open_i (const ACE::HTBP::Addr& addr, -1); ACE_NEW_RETURN (this->concurrency_strategy_, - CONCURRENCY_STRATEGY (), + CONCURRENCY_STRATEGY (this->orb_core_), -1); ACE_NEW_RETURN (this->accept_strategy_, diff --git a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor.h b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor.h index 23607f8b5ac..5828f30eaa9 100644 --- a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor.h +++ b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor.h @@ -20,6 +20,7 @@ #include "orbsvcs/HTIOP/HTIOP_Completion_Handler.h" #include "orbsvcs/HTIOP/HTIOP_Connection_Handler.h" +#include "orbsvcs/HTIOP/HTIOP_Acceptor_Impl.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -78,10 +79,10 @@ namespace TAO /// Returns the array of endpoints in this acceptor const ACE::HTBP::Addr *endpoints (void); - typedef ACE_Strategy_Acceptor<Completion_Handler, ACE_SOCK_ACCEPTOR> BASE_ACCEPTOR; - typedef TAO_Creation_Strategy<Completion_Handler> CREATION_STRATEGY; - typedef ACE_Concurrency_Strategy<Completion_Handler> CONCURRENCY_STRATEGY; - typedef TAO_Accept_Strategy<Completion_Handler, ACE_SOCK_ACCEPTOR> ACCEPT_STRATEGY; + typedef TAO_Strategy_Acceptor<Completion_Handler, ACE_SOCK_ACCEPTOR> BASE_ACCEPTOR; + typedef Creation_Strategy<Completion_Handler> CREATION_STRATEGY; + typedef Concurrency_Strategy<Completion_Handler> CONCURRENCY_STRATEGY; + typedef Accept_Strategy<Completion_Handler, ACE_SOCK_ACCEPTOR> ACCEPT_STRATEGY; /** * The TAO::Acceptor methods, check the documentation in diff --git a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.cpp b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.cpp index 0a0e452a2e7..525a9ab4609 100644 --- a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.cpp +++ b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.cpp @@ -10,9 +10,6 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/HTBP/HTBP_Stream.h" -#include "ace/HTBP/HTBP_Session.h" - #include "tao/ORB_Core.h" #include "tao/ORB_Table.h" #include "tao/Server_Strategy_Factory.h" @@ -37,7 +34,6 @@ TAO::HTIOP::Creation_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh) { if (sh == 0) { - ACE_DEBUG ((LM_DEBUG, "Make Svc Handler\n")); ACE_NEW_RETURN (sh, SVC_HANDLER (this->orb_core_), -1); @@ -57,264 +53,51 @@ TAO::HTIOP::Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::Accept_Strategy ( template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int TAO::HTIOP::Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open ( const ACE_PEER_ACCEPTOR_ADDR &local_addr, - int restart) -{ - if (this->peer_acceptor_.open (local_addr, restart) == -1) - return -1; - - this->peer_acceptor_.enable (ACE_NONBLOCK); - - return 0; -} - - -/// Returns the underlying PEER_ACCEPTOR object -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> ACE_PEER_ACCEPTOR & -TAO::HTIOP::Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::acceptor (void) const + bool restart) { - return (ACE_PEER_ACCEPTOR &) this->peer_acceptor_; -} - -/// Returns the underlying PEER_ACCEPTOR object -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> ACE_HANDLE -TAO::HTIOP::Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::get_handle (void) const -{ - return this->peer_acceptor_.get_handle (); + return ACCEPT_STRATEGY_BASE::open (local_addr, restart); } template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int TAO::HTIOP::Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler (SVC_HANDLER *svc_handler) { - ACE_DEBUG ((LM_DEBUG, "accept_svc_handler\n")); - if (this->peer_acceptor_.accept (svc_handler->peer (), - 0, - 0, - 1, - 0 /* reset_new_handle */) == -1) - { - svc_handler->close (0); - - return -1; - } - - ACE_DEBUG ((LM_DEBUG, "Accept_svc_handler, skipping first_recv\n")); - return 0; -} - -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> -TAO::HTIOP::Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>:: -Strategy_Acceptor (const ACE_TCHAR service_name[], - const ACE_TCHAR service_description[], - int use_select, - int reuse_addr) - -{ - ACE_UNUSED_ARG (service_name); - ACE_UNUSED_ARG (service_description); - ACE_UNUSED_ARG (use_select); - ACE_UNUSED_ARG (reuse_addr); -} - -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int -TAO::HTIOP::Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::shared_open ( - const ACE_PEER_ACCEPTOR_ADDR &local_addr, - int protocol_family, - int backlog) -{ - int error = 0; -#if defined (ACE_HAS_IPV6) - ACE_ASSERT (protocol_family == PF_INET || protocol_family == PF_INET6); - - if (protocol_family == PF_INET6) + int const result = ACCEPT_STRATEGY_BASE::accept_svc_handler (svc_handler); + if (result == -1) { - sockaddr_in6 local_inet6_addr; - ACE_OS::memset (reinterpret_cast<void *> (&local_inet6_addr), - 0, - sizeof local_inet6_addr); + svc_handler->remove_reference (); - if (local_addr == ACE_Addr::sap_any) - { - local_inet6_addr.sin6_family = AF_INET6; - local_inet6_addr.sin6_port = 0; - local_inet6_addr.sin6_addr = in6addr_any; - } - else - local_inet6_addr = *reinterpret_cast<sockaddr_in6 *> (local_addr.get_addr ()); - - // We probably don't need a bind_port written here. - // There are currently no supported OS's that define - // ACE_LACKS_WILDCARD_BIND. - if (ACE_OS::bind (this->get_handle (), - reinterpret_cast<sockaddr *> (&local_inet6_addr), - sizeof local_inet6_addr) == -1) - error = 1; + // #REFCOUNT# is zero at this point. } - else -#endif - if (protocol_family == PF_INET) - { - sockaddr_in local_inet_addr; - ACE_OS::memset (reinterpret_cast<void *> (&local_inet_addr), - 0, - sizeof local_inet_addr); - - if (local_addr == ACE_Addr::sap_any) - { - local_inet_addr.sin_port = 0; - } - else - local_inet_addr = *reinterpret_cast<sockaddr_in *> (local_addr.get_addr ()); - if (local_inet_addr.sin_port == 0) - { - if (ACE::bind_port (this->get_handle ()) == -1) - error = 1; - } - else if (ACE_OS::bind (this->get_handle (), - reinterpret_cast<sockaddr *> (&local_inet_addr), - sizeof local_inet_addr) == -1) - error = 1; - } - else if (ACE_OS::bind (this->get_handle (), - (sockaddr *) local_addr.get_addr (), - local_addr.get_size ()) == -1) - error = 1; - - if (error != 0 - || ACE_OS::listen (this->get_handle (), - backlog) == -1) - { - error = 1; - this->close (); - } - - return error ? -1 : 0; -} - -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int -TAO::HTIOP::Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open( - const ACE_PEER_ACCEPTOR_ADDR &local_addr, - ACE_Reactor *reactor, - TAO::HTIOP::Creation_Strategy<SVC_HANDLER> * cre_s, - TAO::HTIOP::Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> *acc_s, - ACE_Concurrency_Strategy<SVC_HANDLER> *con_s, - int reuse_addr) -{ - this->reactor (reactor); - - this->accept_strategy_ = acc_s; - this->concurrency_strategy_ = con_s; - this->creation_strategy_ = cre_s; - - if (this->accept_strategy_->open (local_addr, reuse_addr) == -1) - return -1; - - if (this->accept_strategy_->acceptor ().enable (ACE_NONBLOCK) != 0) - return -1; - - int result = - reactor->register_handler (this, - ACE_Event_Handler::ACCEPT_MASK); - return result; } -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int -TAO::HTIOP::Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::close () -{ - ACE_TRACE ("TAO::HTIOP::Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::close"); - - // Guard against multiple closes. - if (this->reactor () != 0) - { - ACE_HANDLE handle = this->get_handle (); - - this->reactor ()->remove_handler - (handle, - // We must pass the DONT_CALL flag here to avoid infinite - // recursion. - ACE_Event_Handler::ACCEPT_MASK | ACE_Event_Handler::DONT_CALL); - - // Shut down the listen socket to recycle the handles. - if (this->accept_strategy_->acceptor ().close () == -1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("close\n"))); - // Set the Reactor to 0 so that we don't try to close down - // again. - this->reactor (0); - } - return 0; -} +/////////////////////////////////////////////////////////////////////////////// -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> ACE_HANDLE -TAO::HTIOP::Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::get_handle () const +template <class SVC_HANDLER> +TAO::HTIOP::Concurrency_Strategy<SVC_HANDLER>::Concurrency_Strategy (TAO_ORB_Core *orb_core) + : orb_core_ (orb_core) { - return this->accept_strategy_->get_handle (); } -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int -TAO::HTIOP::Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::handle_input (ACE_HANDLE listener) +template <class SVC_HANDLER> int +TAO::HTIOP::Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *sh, + void *arg) { - ACE_Handle_Set conn_handle; - - ACE_Time_Value timeout; + if (this->CONCURRENCY_STRATEGY_BASE::activate_svc_handler (sh, + arg) == -1) + { + // Activation fails, decrease reference. + sh->remove_reference (); - # if defined (ACE_WIN64) - // This arg is ignored on Windows and causes pointer truncation - // warnings on 64-bit compiles. - int select_width = 0; -# else - int select_width = int (listener) + 1; -# endif /* ACE_WIN64 */ + // #REFCOUNT# is zero at this point. - // TAO_HTIOP connections cannot be attached to sessions or anything else until - // after the HTTP request header is read. So the acceptor here just creates - // completion handler that gets the header data and then creates the - // association between the connection handler and the session, or - // re-establishes an existing session. - do - { - TAO::HTIOP::Completion_Handler *sh = 0; - if (this->make_svc_handler(sh) == -1 || - this->accept_svc_handler (sh) == -1 || - this->activate_svc_handler (sh) == -1) - return -1; + return -1; } - // Now, check to see if there is another connection pending and - // break out of the loop if there is none. - - //int use_select = 1; - while (1 - && ACE_OS::select (select_width, - conn_handle, - 0, - 0, - &timeout) == 1); return 0; } - -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int -TAO::HTIOP::Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::activate_svc_handler (SVC_HANDLER *svc_handler) -{ - return this->concurrency_strategy_->activate_svc_handler (svc_handler, - (void *) this); -} - - -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int -TAO::HTIOP::Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler (SVC_HANDLER *svc_handler) -{ - return this->accept_strategy_->accept_svc_handler (svc_handler); -} - -template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int -TAO::HTIOP::Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::make_svc_handler (SVC_HANDLER *&sh) -{ - return this->creation_strategy_->make_svc_handler (sh); -} - TAO_END_VERSIONED_NAMESPACE_DECL #endif /* HTIOP_ACCEPTOR_IMPL_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.h b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.h index e347fe8dd8e..1b0d6a08869 100644 --- a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.h +++ b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Acceptor_Impl.h @@ -58,81 +58,53 @@ namespace TAO }; template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> - class Accept_Strategy + class Accept_Strategy : public ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> { public: - /// Constructor. Accept_Strategy (TAO_ORB_Core *orb_core); /// Initialize the <peer_acceptor_> with <local_addr>. If the /// process runs out of handles, purge some "old" connections. int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, - int restart = 0); - - /// Returns the underlying PEER_ACCEPTOR object - ACE_PEER_ACCEPTOR &acceptor (void) const; + bool restart = false); /// Delegates to the <accept> method of the PEER_ACCEPTOR. If the /// process runs out of handles, purge some "old" connections. int accept_svc_handler (SVC_HANDLER *svc_handler); - ACE_HANDLE get_handle (void) const; - protected: + /// Base class. + typedef ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> ACCEPT_STRATEGY_BASE; /// Pointer to the ORB Core. TAO_ORB_Core *orb_core_; - - private: - - /// Factory that establishes connections passively - ACE_PEER_ACCEPTOR peer_acceptor_; }; - - template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> - class Strategy_Acceptor : public ACE_Service_Object + /** + * @class Concurrency_Strategy + * + * @brief Activates the Svc_Handler. + */ + template <class SVC_HANDLER> + class Concurrency_Strategy : public ACE_Concurrency_Strategy<SVC_HANDLER> { public: + /// Constructor. + Concurrency_Strategy (TAO_ORB_Core *orb_core); - /// Default constructor. - Strategy_Acceptor (const ACE_TCHAR service_name[] = 0, - const ACE_TCHAR service_description[] = 0, - int use_select = 1, - int reuse_addr = 1); - - int open (const ACE_PEER_ACCEPTOR_ADDR &, - ACE_Reactor * = ACE_Reactor::instance (), - Creation_Strategy<SVC_HANDLER> * = 0, - Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> * =0, - ACE_Concurrency_Strategy<SVC_HANDLER> * = 0, - int reuse_addr = 1); - - int close (); - - virtual ACE_HANDLE get_handle (void) const; - - - private: - - int handle_input (ACE_HANDLE); - - int activate_svc_handler (SVC_HANDLER *svc_handler); - - int accept_svc_handler (SVC_HANDLER *svc_handler); - - int make_svc_handler (SVC_HANDLER *&sh); - - int shared_open (const ACE_PEER_ACCEPTOR_ADDR &, - int protocol_family, - int backlog); - - Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> *accept_strategy_; + /** + * Activates the Svc_Handler. + */ + int activate_svc_handler (SVC_HANDLER *svc_handler, + void *arg); - Creation_Strategy<SVC_HANDLER> * creation_strategy_; + protected: + /// Base class. + typedef ACE_Concurrency_Strategy<SVC_HANDLER> CONCURRENCY_STRATEGY_BASE; - ACE_Concurrency_Strategy<SVC_HANDLER> * concurrency_strategy_; + /// Pointer to the ORB Core. + TAO_ORB_Core *orb_core_; }; } diff --git a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Completion_Handler.cpp b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Completion_Handler.cpp index 4e0cb58398d..c5e411efe7d 100644 --- a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Completion_Handler.cpp +++ b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Completion_Handler.cpp @@ -27,6 +27,7 @@ TAO::HTIOP::Completion_Handler::Completion_Handler (ACE_Thread_Manager *t) : COMPLETION_BASE(t,0,0), orb_core_ (0), channel_(0), + creation_strategy_ (0), concurrency_strategy_ (0) { // This constructor should *never* get called, it is just here to @@ -42,6 +43,7 @@ TAO::HTIOP::Completion_Handler::Completion_Handler (TAO_ORB_Core *orb_core, : COMPLETION_BASE(orb_core->thr_mgr(),0,0), orb_core_ (orb_core), channel_(0), + creation_strategy_ (0), concurrency_strategy_ (0) { } @@ -49,6 +51,8 @@ TAO::HTIOP::Completion_Handler::Completion_Handler (TAO_ORB_Core *orb_core, TAO::HTIOP::Completion_Handler::~Completion_Handler (void) { + delete this->creation_strategy_; + delete this->concurrency_strategy_; } int @@ -57,6 +61,9 @@ TAO::HTIOP::Completion_Handler::open (void*) this->orb_core_->reactor()->register_handler(this, ACE_Event_Handler::READ_MASK); + ACE_NEW_RETURN (creation_strategy_, + TAO::HTIOP::CREATION_STRATEGY2 (this->orb_core_), + -1); ACE_NEW_RETURN (concurrency_strategy_, TAO::HTIOP::CONCURRENCY_STRATEGY2 (this->orb_core_), -1); @@ -102,7 +109,7 @@ TAO::HTIOP::Completion_Handler::handle_input (ACE_HANDLE h) if (handler == 0) { TAO::HTIOP::Connection_Handler *svc_handler = 0; - if (this->make_svc_handler (svc_handler) == -1) + if (this->creation_strategy_->make_svc_handler (svc_handler) == -1) { if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, @@ -148,27 +155,6 @@ TAO::HTIOP::Completion_Handler::handle_input (ACE_HANDLE h) } int -TAO::HTIOP::Completion_Handler::make_svc_handler (TAO::HTIOP::Connection_Handler *&sh) -{ - if (sh == 0) - { - // Purge connections (if necessary) - this->orb_core_->lane_resources ().transport_cache ().purge (); - ACE_NEW_RETURN (sh, - TAO::HTIOP::Connection_Handler (this->orb_core_), - -1); - } - - return 0; -} - -int -TAO::HTIOP::Completion_Handler::add_transport_to_cache (void) -{ - return 0; -} - -int TAO::HTIOP::Completion_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask) { diff --git a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Completion_Handler.h b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Completion_Handler.h index 63ba0a96b34..60a54fee231 100644 --- a/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Completion_Handler.h +++ b/TAO/orbsvcs/orbsvcs/HTIOP/HTIOP_Completion_Handler.h @@ -48,6 +48,7 @@ namespace TAO * session, or to a newly created one. */ + typedef TAO_Creation_Strategy<Connection_Handler> CREATION_STRATEGY2; typedef TAO_Concurrency_Strategy<Connection_Handler> CONCURRENCY_STRATEGY2; typedef ACE_Svc_Handler<ACE_SOCK_STREAM,ACE_NULL_SYNCH> COMPLETION_BASE; @@ -78,16 +79,11 @@ namespace TAO virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask); //@} - // this does nothing, but satisfies a requirement for the TAO_Accept_stratgy. - int add_transport_to_cache (void); - private: - int make_svc_handler (Connection_Handler *&sh); - int activate_svc_handler (Connection_Handler *sh); - TAO_ORB_Core *orb_core_; ACE::HTBP::Channel *channel_; + CREATION_STRATEGY2 *creation_strategy_; CONCURRENCY_STRATEGY2 *concurrency_strategy_; }; } diff --git a/TAO/tao/Acceptor_Impl.cpp b/TAO/tao/Acceptor_Impl.cpp index 7a56e393af6..c1e4a914064 100644 --- a/TAO/tao/Acceptor_Impl.cpp +++ b/TAO/tao/Acceptor_Impl.cpp @@ -210,7 +210,7 @@ TAO_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler (SVC_H int const result = ACCEPT_STRATEGY_BASE::accept_svc_handler (svc_handler); if (result == -1) { -// svc_handler->transport ()->remove_reference (); + svc_handler->transport ()->remove_reference (); // #REFCOUNT# is zero at this point. } |