diff options
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp | 110 |
1 files changed, 39 insertions, 71 deletions
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp index 665bdeef1bd..b8b7bf020cd 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp @@ -6,7 +6,7 @@ #include "tao/Timeprobe.h" #include "tao/debug.h" -#include "tao/Base_Transport_Property.h" +#include "tao/Base_Connection_Property.h" #include "tao/ORB_Core.h" #include "tao/ORB.h" #include "tao/CDR.h" @@ -15,14 +15,12 @@ #include "tao/IIOP_Endpoint.h" + #if !defined (__ACE_INLINE__) # include "SSLIOP_Connection_Handler.i" #endif /* ! __ACE_INLINE__ */ -ACE_RCSID (TAO_SSLIOP, - SSLIOP_Connection_Handler, - "$Id$") - +ACE_RCSID(TAO_SSLIOP, SSLIOP_Connection_Handler, "$Id$") // **************************************************************** @@ -32,7 +30,8 @@ TAO_SSLIOP_Connection_Handler::TAO_SSLIOP_Connection_Handler ( TAO_Connection_Handler (0), current_ (), current_impl_ (), - pending_upcalls_ (1), + transport_ (this, 0, 0), + refcount_ (1), tcp_properties_ (0) { // This constructor should *never* get called, it is just here to @@ -46,49 +45,27 @@ TAO_SSLIOP_Connection_Handler::TAO_SSLIOP_Connection_Handler ( TAO_SSLIOP_Connection_Handler::TAO_SSLIOP_Connection_Handler ( TAO_ORB_Core *orb_core, - CORBA::Boolean /* flag */, // SSLIOP does *not* suport GIOPlite + CORBA::Boolean flag, void *arg) : TAO_SSL_SVC_HANDLER (orb_core->thr_mgr (), 0, 0), TAO_Connection_Handler (orb_core), current_ (), current_impl_ (), - pending_upcalls_ (1), + transport_ (this, orb_core, flag), + refcount_ (1), tcp_properties_ (ACE_static_cast (TAO_IIOP_Properties *, arg)) { - TAO_SSLIOP_Transport* specific_transport = 0; - ACE_NEW (specific_transport, - TAO_SSLIOP_Transport (this, orb_core, 0)); - - // store this pointer (indirectly increment ref count) - this->transport (specific_transport); - TAO_Transport::release (specific_transport); } TAO_SSLIOP_Connection_Handler:: -~TAO_SSLIOP_Connection_Handler (void) + ~TAO_SSLIOP_Connection_Handler (void) { - if (this->transport () != 0) - { - // If the socket has not already been closed. - if (this->get_handle () != ACE_INVALID_HANDLE) - { - // Cannot deal with errors, and therefore they are ignored. - this->transport ()->send_buffered_messages (); - } - else - { - // Dequeue messages and delete message blocks. - this->transport ()->dequeue_all (); - } - } } - - int -TAO_SSLIOP_Connection_Handler::open (void *) +TAO_SSLIOP_Connection_Handler::open (void*) { if (this->set_socket_option (this->peer (), tcp_properties_->send_buffer_size, @@ -106,7 +83,7 @@ TAO_SSLIOP_Connection_Handler::open (void *) return -1; #endif /* ! ACE_LACKS_TCP_NODELAY */ - if (this->transport ()->wait_strategy ()->non_blocking ()) + if (this->transport_.wait_strategy ()->non_blocking ()) { if (this->peer ().enable (ACE_NONBLOCK) == -1) return -1; @@ -197,8 +174,8 @@ TAO_SSLIOP_Connection_Handler::handle_close (ACE_HANDLE handle, handle, rm)); - --this->pending_upcalls_; - if (this->pending_upcalls_ == 0 && + --this->refcount_; + if (this->refcount_ == 0 && this->is_registered ()) { // Set the flag to indicate that it is no longer registered with @@ -209,23 +186,14 @@ TAO_SSLIOP_Connection_Handler::handle_close (ACE_HANDLE handle, // Close the handle.. if (this->get_handle () != ACE_INVALID_HANDLE) { - // Send the buffered messages first - this->transport ()->send_buffered_messages (); + this->peer ().close (); // Purge the entry too - this->transport ()->mark_invalid (); - - // Signal the transport that we will no longer have - // a reference to it. This will eventually call - // TAO_Transport::release (). - this->transport (0); - - this->peer ().close (); + this->mark_invalid (); } - // Follow usual Reactor-style lifecycle semantics and commit - // suicide. - delete this; + // Decrement the reference count + this->decr_ref_count (); } return 0; @@ -243,24 +211,23 @@ int TAO_SSLIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &, const void *) { - // This method is called when buffering timer expires. - // - ACE_Time_Value *max_wait_time = 0; + // Cannot deal with errors, and therefore they are ignored. + if (this->transport ()->handle_output () == -1) + return -1; - TAO_Stub *stub = 0; - int has_timeout; - this->orb_core ()->call_timeout_hook (stub, - has_timeout, - *max_wait_time); + return 0; +} - // Cannot deal with errors, and therefore they are ignored. - this->transport ()->send_buffered_messages (max_wait_time); +int +TAO_SSLIOP_Connection_Handler::close (u_long) +{ + this->decr_ref_count (); return 0; } int -TAO_SSLIOP_Connection_Handler::add_transport_to_cache (void) +TAO_SSLIOP_Connection_Handler::add_handler_to_cache (void) { ACE_INET_Addr addr; @@ -276,11 +243,11 @@ TAO_SSLIOP_Connection_Handler::add_transport_to_cache (void) &tmpoint); // Construct a property object - TAO_Base_Transport_Property prop (&endpoint); + TAO_Base_Connection_Property prop (&endpoint); // Add the handler to Cache - return this->orb_core ()->transport_cache ().cache_transport (&prop, - this->transport ()); + return this->orb_core ()->connection_cache ().cache_handler (&prop, + this); } @@ -308,19 +275,19 @@ TAO_SSLIOP_Connection_Handler::process_listen_point_list ( // Construct a property object - TAO_Base_Transport_Property prop (&endpoint); + TAO_Base_Connection_Property prop (&endpoint); // Mark the connection as bidirectional prop.set_bidir_flag (1); // The property for this handler has changed. Recache the // handler with this property - int retval = this->transport ()->recache_transport (&prop); + int retval = this->recache_handler (&prop); if (retval == -1) return retval; // Make the handler idle and ready for use - this->transport ()->make_idle (); + this->make_idle (); } return 0; @@ -342,17 +309,16 @@ TAO_SSLIOP_Connection_Handler::handle_input_i (ACE_HANDLE, int result; // Set up the SSLIOP::Current object. - TAO_SSL_State_Guard ssl_state_guard (this, - this->orb_core (), + TAO_SSL_State_Guard ssl_state_guard (this, this->orb_core (), result); if (result == -1) return -1; - this->pending_upcalls_++; + this->refcount_++; // Call the transport read the message - result = this->transport ()->read_process_message (max_wait_time); + result = this->transport_.read_process_message (max_wait_time); // Now the message has been read if (result == -1 && TAO_debug_level > 0) @@ -364,7 +330,9 @@ TAO_SSLIOP_Connection_Handler::handle_input_i (ACE_HANDLE, } // The upcall is done. Bump down the reference count - --this->pending_upcalls_; + --this->refcount_; + if (this->refcount_ == 0) + this->decr_ref_count (); if (result == 0 || result == -1) { |