diff options
Diffstat (limited to 'TAO/tao/IIOP_Connect.cpp')
-rw-r--r-- | TAO/tao/IIOP_Connect.cpp | 131 |
1 files changed, 84 insertions, 47 deletions
diff --git a/TAO/tao/IIOP_Connect.cpp b/TAO/tao/IIOP_Connect.cpp index 1a35d7df728..3c4173641f1 100644 --- a/TAO/tao/IIOP_Connect.cpp +++ b/TAO/tao/IIOP_Connect.cpp @@ -2,51 +2,57 @@ #include "tao/IIOP_Connect.h" #include "tao/Timeprobe.h" +#include "tao/IIOP_Transport.h" #include "tao/debug.h" #include "tao/ORB_Core.h" #include "tao/ORB.h" #include "tao/CDR.h" -#include "tao/GIOP.h" +#include "tao/Wait_Strategy.h" #if !defined (__ACE_INLINE__) # include "tao/IIOP_Connect.i" #endif /* ! __ACE_INLINE__ */ -ACE_RCSID(tao, IIOP_Connect, "$Id$") +ACE_RCSID(tao, Connect, "$Id$") #if defined (ACE_ENABLE_TIMEPROBES) -static const char *TAO_IIOP_Connect_Timeprobe_Description[] = + static const char *TAO_Connect_Timeprobe_Description[] = { - "IIOP_Server_Connection_Handler::handle_input - start", - "IIOP_Server_Connection_Handler::handle_input - end", + "Server_Connection_Handler::handle_input - start", + "Server_Connection_Handler::handle_input - end", - "IIOP_Server_Connection_Handler::handle_locate - start", - "IIOP_Server_Connection_Handler::handle_locate - end", + "Server_Connection_Handler::handle_locate - start", + "Server_Connection_Handler::handle_locate - end", - "IIOP_Server_Connection_Handler::receive_request - end", + "Server_Connection_Handler::receive_request - end", "IIOP_Client_Connection_Handler::send_request - start", - "IIOP_Client_Connection_Handler::send_request - end"}; + "IIOP_Client_Connection_Handler::send_request - end", + + "GIOP::Send_Request - return" +}; enum { // Timeprobe description table start key - TAO_IIOP_SERVER_CONNECTION_HANDLER_HANDLE_INPUT_START = 300, - TAO_IIOP_SERVER_CONNECTION_HANDLER_HANDLE_INPUT_END, + TAO_SERVER_CONNECTION_HANDLER_HANDLE_INPUT_START = 300, + TAO_SERVER_CONNECTION_HANDLER_HANDLE_INPUT_END, - TAO_IIOP_SERVER_CONNECTION_HANDLER_HANDLE_LOCATE_START, - TAO_IIOP_SERVER_CONNECTION_HANDLER_HANDLE_LOCATE_END, + TAO_SERVER_CONNECTION_HANDLER_HANDLE_LOCATE_START, + TAO_SERVER_CONNECTION_HANDLER_HANDLE_LOCATE_END, - TAO_IIOP_SERVER_CONNECTION_HANDLER_RECEIVE_REQUEST_END, + TAO_SERVER_CONNECTION_HANDLER_RECEIVE_REQUEST_END, TAO_IIOP_CLIENT_CONNECTION_HANDLER_SEND_REQUEST_START, - TAO_IIOP_CLIENT_CONNECTION_HANDLER_SEND_REQUEST_END + TAO_IIOP_CLIENT_CONNECTION_HANDLER_SEND_REQUEST_END, + + GIOP_SEND_REQUEST_RETURN }; // Setup Timeprobes -ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_IIOP_Connect_Timeprobe_Description, - TAO_IIOP_SERVER_CONNECTION_HANDLER_HANDLE_INPUT_START); +ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_Connect_Timeprobe_Description, + TAO_SERVER_CONNECTION_HANDLER_SEND_RESPONSE_START); #endif /* ACE_ENABLE_TIMEPROBES */ @@ -64,7 +70,6 @@ TAO_IIOP_Handler_Base::TAO_IIOP_Handler_Base (ACE_Thread_Manager *t) TAO_IIOP_Server_Connection_Handler::TAO_IIOP_Server_Connection_Handler (ACE_Thread_Manager *t) : TAO_IIOP_Handler_Base (t), - transport_ (this, 0), orb_core_ (0), tss_resources_ (0) { @@ -78,14 +83,24 @@ TAO_IIOP_Server_Connection_Handler::TAO_IIOP_Server_Connection_Handler (ACE_Thre TAO_IIOP_Server_Connection_Handler::TAO_IIOP_Server_Connection_Handler (TAO_ORB_Core *orb_core) : TAO_IIOP_Handler_Base (orb_core), - transport_ (this, orb_core), orb_core_ (orb_core), tss_resources_ (orb_core->get_tss_resources ()) { + transport_ = new TAO_IIOP_Server_Transport (this, + this->orb_core_); } TAO_IIOP_Server_Connection_Handler::~TAO_IIOP_Server_Connection_Handler (void) { + delete this->transport_; + this->transport_ = 0; +} + +TAO_Transport * +TAO_IIOP_Server_Connection_Handler::transport (void) +{ + // @@ For now return nothing since all is not in place! + return transport_; } int @@ -137,9 +152,8 @@ TAO_IIOP_Server_Connection_Handler::open (void*) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - "(%P|%t) IIOP connection from client <%s> on %d\n", + "(%P|%t) connection from client <%s> on %d\n", client, this->peer ().get_handle ())); - return 0; } @@ -157,8 +171,7 @@ TAO_IIOP_Server_Connection_Handler::activate (long flags, { if (TAO_orbdebug) ACE_DEBUG ((LM_DEBUG, - "(%P|%t) TAO_IIOP_Server_Connection_Handler::activate %d " - "threads, flags = %d\n", + "(%P|%t) TAO_IIOP_Server_Connection_Handler::activate %d threads, flags = %d\n", n_threads, flags, THR_BOUND)); @@ -181,8 +194,7 @@ TAO_IIOP_Server_Connection_Handler::handle_close (ACE_HANDLE handle, { if (TAO_orbdebug) ACE_DEBUG ((LM_DEBUG, - "(%P|%t) TAO_IIOP_Server_Connection_Handler::handle_close " - "(%d, %d)\n", + "(%P|%t) TAO_IIOP_Server_Connection_Handler::handle_close (%d, %d)\n", handle, rm)); @@ -223,30 +235,24 @@ TAO_IIOP_Server_Connection_Handler::handle_input (ACE_HANDLE) { int result = TAO_GIOP::handle_input (this->transport (), this->orb_core_, - this->transport_.message_state_); + this->transport_->message_state_); if (result == -1 && TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - %p\n", - "TAO_IIOP_Server_Connection_Handler::handle_input, " - "handle_input")); + "IIOP_Server_CH::handle_input, handle_input")); } if (result == 0 || result == -1) return result; - result = TAO_GIOP::process_server_message (this->transport (), - this->orb_core_, - this->transport_.message_state_.cdr, - this->transport_.message_state_); - if (result != -1) - { - this->transport_.message_state_.reset (); - result = 0; - } - - return result; + TAO_GIOP::process_server_message (this->transport (), + this->orb_core_, + this->transport_->message_state_.cdr, + this->transport_->message_state_); + this->transport_->message_state_.reset (); + return 0; } // **************************************************************** @@ -255,16 +261,23 @@ TAO_IIOP_Server_Connection_Handler::handle_input (ACE_HANDLE) TAO_IIOP_Client_Connection_Handler:: TAO_IIOP_Client_Connection_Handler (ACE_Thread_Manager *t, TAO_ORB_Core* orb_core) - : TAO_IIOP_Handler_Base (t), - transport_ (this, orb_core), - orb_core_ (orb_core) + : TAO_IIOP_Handler_Base (t) { + transport_ = new TAO_IIOP_Client_Transport (this, + orb_core); } TAO_IIOP_Client_Connection_Handler::~TAO_IIOP_Client_Connection_Handler (void) { + delete this->transport_; + this->transport_ = 0; } +TAO_Transport * +TAO_IIOP_Client_Connection_Handler::transport (void) +{ + return this->transport_; +} // @@ Should I do something here to enable non-blocking?? (Alex). // @@ Alex: I don't know if this is the place to do it, but the way to @@ -282,11 +295,12 @@ TAO_IIOP_Client_Connection_Handler::open (void *) // Here is where we could enable all sorts of things such as // nonblock I/O, sock buf sizes, TCP no-delay, etc. + // @@ We should use this->orb_core_!! #if !defined (ACE_LACKS_SOCKET_BUFSIZ) int sndbufsize = - this->orb_core_->orb_params ()->sock_sndbuf_size (); + this->transport ()->orb_core ()->orb_params ()->sock_sndbuf_size (); int rcvbufsize = - this->orb_core_->orb_params ()->sock_rcvbuf_size (); + this->transport ()->orb_core ()->orb_params ()->sock_rcvbuf_size (); if (this->peer ().set_option (SOL_SOCKET, SO_SNDBUF, @@ -332,7 +346,7 @@ TAO_IIOP_Client_Connection_Handler::open (void *) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, - "(%P|%t) IIOP connection to server <%s> on %d\n", + "(%P|%t) connection to server <%s> on %d\n", server, this->peer ().get_handle ())); // Register the handler with the Reactor if necessary. @@ -340,6 +354,13 @@ TAO_IIOP_Client_Connection_Handler::open (void *) } int +TAO_IIOP_Client_Connection_Handler::handle_input (ACE_HANDLE) +{ + // Call the waiter to handle the input. + return this->transport ()->wait_strategy ()->handle_input (); +} + +int TAO_IIOP_Client_Connection_Handler::handle_close (ACE_HANDLE handle, ACE_Reactor_Mask rm) { @@ -361,8 +382,8 @@ TAO_IIOP_Client_Connection_Handler::handle_close (ACE_HANDLE handle, // Deregister this handler with the ACE_Reactor. if (this->reactor ()) { - ACE_Reactor_Mask mask = - ACE_Event_Handler::ALL_EVENTS_MASK | ACE_Event_Handler::DONT_CALL; + ACE_Reactor_Mask mask = ACE_Event_Handler::ALL_EVENTS_MASK | + ACE_Event_Handler::DONT_CALL; // Make sure there are no timers. this->reactor ()->cancel_timer (this); @@ -376,11 +397,27 @@ TAO_IIOP_Client_Connection_Handler::handle_close (ACE_HANDLE handle, return 0; } +int +TAO_IIOP_Client_Connection_Handler::close (u_long flags) +{ + this->destroy (); + + return 0; +} // **************************************************************** +// @@ Are these instantiations still required?? Where? Not on this +// file, so they shouldn't be here! + #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Unbounded_Set<ACE_INET_Addr>; +template class ACE_Unbounded_Set_Iterator<ACE_INET_Addr>; + #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Unbounded_Set<ACE_INET_Addr> +#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_INET_Addr> + #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ |