From 16d19c42e9d31200788b5a5fac889b7c3a53ba27 Mon Sep 17 00:00:00 2001 From: Chris Cleeland Date: Fri, 23 Mar 2001 22:25:32 +0000 Subject: * tao/GIOP_Message_Base.cpp: * tao/GIOP_Message_Lite.cpp: * tao/GIOP_Utils.cpp: * tao/IIOP_Connector.cpp: * tao/Strategies/UIOP_Connector.cpp: * tao/Strategies/SHMIOP_Connector.cpp: * tao/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp: * tao/Transport.cpp: * tao/Transport.h: * tao/IIOP_Transport.cpp: * tao/IIOP_Transport.h: * tao/Strategies/SHMIOP_Transport.cpp: * tao/Strategies/SHMIOP_Transport.h: * tao/Strategies/UIOP_Transport.cpp: * tao/Strategies/UIOP_Transport.h: * tao/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp: * tao/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h: * examples/PluggableUDP/DIOP/DIOP_Transport.cpp: * examples/PluggableUDP/DIOP/DIOP_Transport.h: * tao/IIOP_Connection_Handler.cpp (activate): * tao/Strategies/UIOP_Connection_Handler.cpp (activate): * tao/Strategies/SHMIOP_Connection_Handler.cpp (activate): * tao/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp (activate): * examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp (activate): --- TAO/ChangeLogs/ChangeLog-02a | 90 ++++++++++++++++++++++ .../PluggableUDP/DIOP/DIOP_Connection_Handler.cpp | 3 + TAO/examples/PluggableUDP/DIOP/DIOP_Transport.cpp | 58 +++++--------- TAO/examples/PluggableUDP/DIOP/DIOP_Transport.h | 47 +++++------ .../orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp | 3 + TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp | 8 +- TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp | 49 ++++++------ TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h | 38 ++++++--- TAO/tao/GIOP_Utils.cpp | 2 +- TAO/tao/IIOP_Connection_Handler.cpp | 3 + TAO/tao/IIOP_Connector.cpp | 14 +--- TAO/tao/IIOP_Transport.cpp | 4 - TAO/tao/IIOP_Transport.h | 65 ++++++++-------- TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp | 3 + TAO/tao/Strategies/SHMIOP_Connector.cpp | 10 +-- TAO/tao/Strategies/SHMIOP_Transport.cpp | 26 ------- TAO/tao/Strategies/SHMIOP_Transport.h | 16 ---- TAO/tao/Strategies/UIOP_Connection_Handler.cpp | 3 + TAO/tao/Strategies/UIOP_Connector.cpp | 10 +-- TAO/tao/Strategies/UIOP_Transport.cpp | 26 ------- TAO/tao/Strategies/UIOP_Transport.h | 14 ---- TAO/tao/Transport.cpp | 17 ++-- TAO/tao/Transport.h | 31 ++------ 23 files changed, 256 insertions(+), 284 deletions(-) diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 8dce6ac702d..986862027ea 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,93 @@ +Fri Mar 23 14:07:58 2001 Chris Cleeland + + * tao/GIOP_Message_Base.cpp: + * tao/GIOP_Message_Lite.cpp: + * tao/GIOP_Utils.cpp: + + Changed uses of TAO_Tranport::handle() to TAO_Transport::id() + the uses were for debug/informational message purposes. + + * tao/IIOP_Connector.cpp: + * tao/Strategies/UIOP_Connector.cpp: + * tao/Strategies/SHMIOP_Connector.cpp: + * tao/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp: + + Changed debug message accesses to the transport's handler's + handle, and replaced with calls to TAO_Transport::id(). + + * tao/Sync_Strategies.cpp (timer_check): Eliminated direct + references to the transport's event handler and used the new + TAO_Transport::register_for_timer_event method to do this in a + lock-safe manner. + + * tao/Transport_Cache_Manager.cpp (make_idle_i): Protected against + being passed a zero pointer as argument. + + * tao/Transport_Cache_Manager.cpp (close_i): Added back code to + fill in an ACE_Handle_Set of all transports' associated handlers + which are registered with the reactor. This is necessary to + perform an orderly close and unloading of the ORB. + + * tao/Transport.cpp: + * tao/Transport.h: + + Added an ACE_Lock, initialized identically to the way that the + TAO_Transport_Cache_Manager's lock is initialized, to lock + accesses to or through the protocol-specific transport's + handler. Although the handler doesn't exist in the generic + TAO_Transport, the lock does so that the framework handles all + the tedious locking issues and the pluggable protocol + implementor only needs to override methods which are called in + lock-safe manner. Note that since the lock is initialized from + the resource factory, single-threaded implementations need not + pay locking penalties. + + Added provide_handle method to permit the Sync Strategies to + fill in an ACE_Handle_Set without violating locking and + encapsulation. + + Made the following methods lock-safe and created corresponding + _i methods which assume that the lock is already held--send, + recv, register_handler, event_handler, transtion_handler_state. + The corresponding _i methods are protected. + + Eliminated service_handler and connection_handler accessors + since all they did was confuse the issue. Moreover, gaining + access to these would have violated the locking protocol. They + weren't necessary, so they're gone. + + Added an id_ data member and getter/setter methods. Formerly, + the connection's handle was used for identifying the + transport--especially in debug messages--but the need for + lock-safety made that unreliable. Now, the id() is used + instead, and transport-savvy connection handlers can feel free + to change the id to anything they desire such as, say, the + handle_. :-) + + * tao/IIOP_Transport.cpp: + * tao/IIOP_Transport.h: + * tao/Strategies/SHMIOP_Transport.cpp: + * tao/Strategies/SHMIOP_Transport.h: + * tao/Strategies/UIOP_Transport.cpp: + * tao/Strategies/UIOP_Transport.h: + * tao/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp: + * tao/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h: + * examples/PluggableUDP/DIOP/DIOP_Transport.cpp: + * examples/PluggableUDP/DIOP/DIOP_Transport.h: + + Updated all of these to reflect the changes outlined for the + TAO_Transport base class. + + * tao/IIOP_Connection_Handler.cpp (activate): + * tao/Strategies/UIOP_Connection_Handler.cpp (activate): + * tao/Strategies/SHMIOP_Connection_Handler.cpp (activate): + * tao/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp (activate): + * examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp (activate): + + Added code to set the transport's id to the handler's handle, + thus making debug messages referring to that (which are + everywhere!) more useful. + Thu Mar 22 19:29:09 2001 Irfan Pyarali * tao/PortableServer/Active_Object_Map.i diff --git a/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp b/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp index daf7b24f8bc..9b24c46178f 100644 --- a/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp +++ b/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp @@ -213,6 +213,9 @@ TAO_DIOP_Connection_Handler::activate (long flags, // @@ Michael: I believe we do not need active service handlers right now. // @@ Frank: Not disabled yet... + // Set the id in the transport now that we're active. + this->transport ()->id (this->get_handle ()); + return TAO_DIOP_SVC_HANDLER::activate (flags, n_threads, force_active, diff --git a/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.cpp b/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.cpp index 61a4aa587db..e549ac38c4f 100644 --- a/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.cpp +++ b/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.cpp @@ -53,28 +53,16 @@ TAO_DIOP_Transport::~TAO_DIOP_Transport (void) delete this->messaging_object_; } -TAO_DIOP_SVC_HANDLER * -TAO_DIOP_Transport::service_handler (void) -{ - return this->connection_handler_; -} - -ACE_HANDLE -TAO_DIOP_Transport::handle (void) -{ - return this->connection_handler_->get_handle (); -} - ACE_Event_Handler * -TAO_DIOP_Transport::event_handler (void) +TAO_DIOP_Transport::event_handler_i (void) { return this->connection_handler_; } ssize_t -TAO_DIOP_Transport::send (const ACE_Message_Block *message_block, - const ACE_Time_Value * /*max_wait_time*/, - size_t *bt) +TAO_DIOP_Transport::send_i (const ACE_Message_Block *message_block, + const ACE_Time_Value * /*max_wait_time*/, + size_t *bt) { const ACE_INET_Addr &addr = this->connection_handler_->addr (); @@ -141,8 +129,8 @@ TAO_DIOP_Transport::send (const ACE_Message_Block *message_block, { ssize_t current_transfer = this->connection_handler_->dgram ().send (iov, - iovcnt, - addr); + iovcnt, + addr); // Errors. if (current_transfer == -1 || current_transfer == 0) return current_transfer; @@ -162,9 +150,9 @@ TAO_DIOP_Transport::send (const ACE_Message_Block *message_block, } ssize_t -TAO_DIOP_Transport::recv (char *buf, - size_t len, - const ACE_Time_Value * /*max_wait_time*/) +TAO_DIOP_Transport::recv_i (char *buf, + size_t len, + const ACE_Time_Value * /*max_wait_time*/) { ACE_INET_Addr from_addr; @@ -174,8 +162,8 @@ TAO_DIOP_Transport::recv (char *buf, { local_buffer_.crunch (); ssize_t n = this->connection_handler_->dgram ().recv (local_buffer_.wr_ptr (), - local_buffer_.size (), - from_addr); + local_buffer_.size (), + from_addr); // Remember the from addr to eventually use it as remote // addr for the reply. @@ -250,7 +238,7 @@ TAO_DIOP_Transport::read_process_message (ACE_Time_Value *max_wait_time, int -TAO_DIOP_Transport::register_handler (void) +TAO_DIOP_Transport::register_handler_i (void) { // @@ It seems like this method should go away, the right reactor is // picked at object creation time. @@ -314,8 +302,8 @@ TAO_DIOP_Transport::send_message (TAO_OutputCDR &stream, { if (TAO_debug_level) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO: (%P|%t|%N|%l) closing conn %d after fault %p\n"), - this->handle (), + ACE_TEXT ("TAO: (%P|%t|%N|%l) closing transport %d after fault %p\n"), + this->id (), ACE_TEXT ("send_message ()\n"))); return -1; @@ -327,8 +315,8 @@ TAO_DIOP_Transport::send_message (TAO_OutputCDR &stream, if (TAO_debug_level) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO: (%P|%t|%N|%l) send_message () \n") - ACE_TEXT ("EOF, closing conn %d\n"), - this->handle())); + ACE_TEXT ("EOF, closing transport %d\n"), + this->id ())); return -1; } @@ -514,8 +502,8 @@ TAO_DIOP_Transport::process_message (void) // every reply on this connection. if (TAO_debug_level > 0) ACE_ERROR ((LM_ERROR, - ACE_TEXT ("TAO (%P|%t) : DIOP_Client_Transport::") - ACE_TEXT ("handle_client_input - ") + ACE_TEXT ("TAO (%P|%t) : DIOP_Transport::") + ACE_TEXT ("process_message - ") ACE_TEXT ("dispatch reply failed\n"))); this->messaging_object_->reset (); @@ -689,13 +677,7 @@ TAO_DIOP_Transport::get_listen_point ( */ void -TAO_DIOP_Transport::transition_handler_state (void) -{ - connection_handler_ = 0; -} - -TAO_Connection_Handler* -TAO_DIOP_Transport::connection_handler (void) const +TAO_DIOP_Transport::transition_handler_state_i (void) { - return connection_handler_; + this->connection_handler_ = 0; } diff --git a/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.h b/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.h index 3fee5adb1cf..c2f33f2f19e 100644 --- a/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.h +++ b/TAO/examples/PluggableUDP/DIOP/DIOP_Transport.h @@ -60,25 +60,25 @@ public: /// Default destructor. ~TAO_DIOP_Transport (void); - /// Return the connection service handler - TAO_DIOP_SVC_HANDLER *service_handler (void); +protected: + /** @name Overridden Template Methods + * + * These are implementations of template methods declared by TAO_Transport. + */ + //@{ - /// The TAO_Transport methods, please check the documentation in - /// "tao/Pluggable.h" for more details. - virtual ACE_HANDLE handle (void); - - virtual ACE_Event_Handler *event_handler (void); + virtual ACE_Event_Handler *event_handler_i (void); /// Write the complete Message_Block chain to the connection. - virtual ssize_t send (const ACE_Message_Block *mblk, - const ACE_Time_Value *s = 0, - size_t *bytes_transferred = 0); + virtual ssize_t send_i (const ACE_Message_Block *mblk, + const ACE_Time_Value *s = 0, + size_t *bytes_transferred = 0); /// Read len bytes from into buf. - virtual ssize_t recv (char *buf, - size_t len, - const ACE_Time_Value *s = 0); + virtual ssize_t recv_i (char *buf, + size_t len, + const ACE_Time_Value *s = 0); /// Read and process the message from the connection. The processing /// of the message is done by delegating the work to the underlying @@ -86,8 +86,13 @@ public: virtual int read_process_message (ACE_Time_Value *max_time_value = 0, int block =0); - virtual int register_handler (void); + virtual int register_handler_i (void); + + /// Method to do whatever it needs to do when the connection + /// handler is being closed and destroyed. + virtual void transition_handler_state_i (void); +public: /// @@TODO: These methods IMHO should have more meaningful /// names. The names seem to indicate nothing. virtual int send_request (TAO_Stub *stub, @@ -124,21 +129,9 @@ public: virtual int messaging_init (CORBA::Octet major, CORBA::Octet minor); - // @@ Frank : Not needed - /* - /// Open the service context list and process it. - virtual int tear_listen_point_list (TAO_InputCDR &cdr); - */ - - /// Method to do whatever it needs to do when the connection - /// handler is being closed and destroyed. - virtual void transition_handler_state (void); - - // Access the connection handler - virtual TAO_Connection_Handler* connection_handler (void) const; + //@} private: - /// Process the message that we have read int process_message (void); diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp index 665bdeef1bd..14e72398fb5 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp @@ -157,6 +157,9 @@ TAO_SSLIOP_Connection_Handler::activate (long flags, flags, THR_BOUND)); + // Set the id in the transport now that we're active. + this->transport ()->id (this->get_handle ()); + return TAO_SSL_SVC_HANDLER::activate (flags, n_threads, force_active, diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp index f877e9208aa..e0ed5fe96d2 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connector.cpp @@ -210,12 +210,8 @@ TAO_SSLIOP_Connector::connect (TAO_Transport_Descriptor_Interface *desc, if (TAO_debug_level > 5) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) SSLIOP_Connector::connect ") - ACE_TEXT ("got an existing connection \n"))); - - // We have found a connection and a handler - svc_handler = - ACE_dynamic_cast (TAO_SSLIOP_Connection_Handler *, - base_transport->connection_handler ()); + ACE_TEXT ("got an existing transport with id %d\n"), + base_transport->id ())); } else { diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp index 5fad414b4a6..bca0c50df4e 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp @@ -42,6 +42,7 @@ TAO_SSLIOP_Transport::~TAO_SSLIOP_Transport (void) delete this->messaging_object_; } +#if 0 TAO_SSL_SVC_HANDLER * TAO_SSLIOP_Transport::service_handler (void) { @@ -53,17 +54,18 @@ TAO_SSLIOP_Transport::handle (void) { return this->connection_handler_->get_handle (); } +#endif ACE_Event_Handler * -TAO_SSLIOP_Transport::event_handler (void) +TAO_SSLIOP_Transport::event_handler_i (void) { return this->connection_handler_; } ssize_t -TAO_SSLIOP_Transport::send (const ACE_Message_Block *message_block, - const ACE_Time_Value *max_wait_time, - size_t *bt) +TAO_SSLIOP_Transport::send_i (const ACE_Message_Block *message_block, + const ACE_Time_Value *max_wait_time, + size_t *bt) { // @@ This code should be refactored into ACE.cpp or something // similar! @@ -98,12 +100,12 @@ TAO_SSLIOP_Transport::send (const ACE_Message_Block *message_block, if (iovcnt == IOV_MAX) { if (max_wait_time == 0) - n = this->service_handler ()->peer ().sendv_n (iov, - iovcnt); + n = this->connection_handler_->peer ().sendv_n (iov, + iovcnt); else // @@ No timeouts!!! - n = this->service_handler ()->peer ().sendv_n (iov, - iovcnt /*, + n = this->connection_handler_->peer ().sendv_n (iov, + iovcnt /*, max_wait_time */); if (n == 0 || @@ -119,8 +121,8 @@ TAO_SSLIOP_Transport::send (const ACE_Message_Block *message_block, // Check for remaining buffers to be sent! if (iovcnt != 0) { - n = this->service_handler ()->peer ().sendv_n (iov, - iovcnt); + n = this->connection_handler_->peer ().sendv_n (iov, + iovcnt); if (n == 0 || n == -1) return n; @@ -132,13 +134,13 @@ TAO_SSLIOP_Transport::send (const ACE_Message_Block *message_block, } ssize_t -TAO_SSLIOP_Transport::recv (char *buf, - size_t len, - const ACE_Time_Value * /*max_wait_time*/) +TAO_SSLIOP_Transport::recv_i (char *buf, + size_t len, + const ACE_Time_Value * /*max_wait_time*/) { - return this->service_handler ()->peer ().recv (buf, - len - /*, max_wait_time*/); + return this->connection_handler_->peer ().recv (buf, + len + /*, max_wait_time*/); } @@ -178,7 +180,7 @@ TAO_SSLIOP_Transport::read_process_message (ACE_Time_Value *max_wait_time, int -TAO_SSLIOP_Transport::register_handler (void) +TAO_SSLIOP_Transport::register_handler_i (void) { // @@ It seems like this method should go away, the right reactor is // picked at object creation time. @@ -242,8 +244,8 @@ TAO_SSLIOP_Transport::send_message (TAO_OutputCDR &stream, { if (TAO_debug_level) ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO: (%P|%t|%N|%l) closing conn %d after fault %p\n"), - this->handle (), + ACE_TEXT ("TAO: (%P|%t|%N|%l) closing transport %d after fault %p\n"), + this->id (), ACE_TEXT ("send_message ()\n"))); return -1; @@ -255,8 +257,8 @@ TAO_SSLIOP_Transport::send_message (TAO_OutputCDR &stream, if (TAO_debug_level) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO: (%P|%t|%N|%l) send_message () \n") - ACE_TEXT ("EOF, closing conn %d\n"), - this->handle())); + ACE_TEXT ("EOF, closing transport %d\n"), + this->id ())); return -1; } @@ -599,13 +601,16 @@ TAO_SSLIOP_Transport::get_listen_point ( } void -TAO_SSLIOP_Transport::transition_handler_state (void) +TAO_SSLIOP_Transport::transition_handler_state_i (void) { connection_handler_ = 0; } +#if 0 TAO_Connection_Handler* TAO_SSLIOP_Transport::connection_handler (void) const { return connection_handler_; } +#endif + diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h index 37e07b07a7f..891748a6283 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h @@ -62,24 +62,33 @@ public: /// Default destructor. ~TAO_SSLIOP_Transport (void); +#if 0 /// Return the connection service handler TAO_SSL_SVC_HANDLER *service_handler (void); /// The TAO_Transport methods, please check the documentation in /// "tao/Pluggable.h" for more details. virtual ACE_HANDLE handle (void); +#endif - virtual ACE_Event_Handler *event_handler (void); +protected: + /** @name Overridden Template Methods + * + * These are implementations of template methods declared by TAO_Transport. + */ + //@{ + + virtual ACE_Event_Handler *event_handler_i (void); /// Write the complete Message_Block chain to the connection. - virtual ssize_t send (const ACE_Message_Block *mblk, - const ACE_Time_Value *s = 0, - size_t *bytes_transferred = 0); + virtual ssize_t send_i (const ACE_Message_Block *mblk, + const ACE_Time_Value *s = 0, + size_t *bytes_transferred = 0); /// Read len bytes from into buf. - virtual ssize_t recv (char *buf, - size_t len, - const ACE_Time_Value *s = 0); + virtual ssize_t recv_i (char *buf, + size_t len, + const ACE_Time_Value *s = 0); /// Read and process the message from the connection. The processing /// of the message is done by delegating the work to the underlying @@ -87,8 +96,13 @@ public: virtual int read_process_message (ACE_Time_Value *max_time_value = 0, int block =0); - virtual int register_handler (void); + virtual int register_handler_i (void); + /// Method to do whatever it needs to do when the connection + /// handler is being closed and destroyed. + virtual void transition_handler_state_i (void); + +public: /// @@TODO: These methods IMHO should have more meaningful /// names. The names seem to indicate nothing. virtual int send_request (TAO_Stub *stub, @@ -128,12 +142,12 @@ public: /// Open teh service context list and process it. virtual int tear_listen_point_list (TAO_InputCDR &cdr); - /// Method to do whatever it needs to do when the connection - /// handler is being closed and destroyed. - virtual void transition_handler_state (void); - +#if 0 // Access the connection handler virtual TAO_Connection_Handler* connection_handler (void) const; +#endif + + //@} private: diff --git a/TAO/tao/GIOP_Utils.cpp b/TAO/tao/GIOP_Utils.cpp index 34600301bbd..67df0d37c77 100644 --- a/TAO/tao/GIOP_Utils.cpp +++ b/TAO/tao/GIOP_Utils.cpp @@ -57,7 +57,7 @@ TAO_GIOP_Utils::read_buffer (TAO_Transport *transport, if (bytes_read <= 0 && TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t|%N|%l) - %p,\n") - ACE_TEXT (" transport = %lu, ") + ACE_TEXT (" transport = %d, ") ACE_TEXT ("bytes = %d, len = %d\n"), ACE_TEXT ("read_buffer"), transport->id (), diff --git a/TAO/tao/IIOP_Connection_Handler.cpp b/TAO/tao/IIOP_Connection_Handler.cpp index 18abad588b8..ddb675cc7d6 100644 --- a/TAO/tao/IIOP_Connection_Handler.cpp +++ b/TAO/tao/IIOP_Connection_Handler.cpp @@ -142,6 +142,9 @@ TAO_IIOP_Connection_Handler::activate (long flags, flags, THR_BOUND)); + // Set the id in the transport now that we're active. + this->transport ()->id (this->get_handle ()); + return TAO_IIOP_SVC_HANDLER::activate (flags, n_threads, force_active, diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index 4f05995a7b7..51dacc45089 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -164,21 +164,11 @@ TAO_IIOP_Connector::connect (TAO_Transport_Descriptor_Interface *desc, if (this->orb_core ()->transport_cache ().find_transport (desc, base_transport) == 0) { -#if 0 - // @@CJC - // Seems that the only reason we have the call to connection_handler is - // to print out the debug message. Yucko! We can ditch it, hopefully. - - // We have found a connection and a transport - svc_handler = - ACE_dynamic_cast (TAO_IIOP_Connection_Handler *, - base_transport->connection_handler ()); if (TAO_debug_level > 2) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) IIOP_Connector::connect - ") - ACE_TEXT ("got an existing connection on HANDLE %d\n"), - svc_handler->peer ().get_handle ())); -#endif + ACE_TEXT ("got an existing transport with id %d\n"), + base_transport->id ())); } else { diff --git a/TAO/tao/IIOP_Transport.cpp b/TAO/tao/IIOP_Transport.cpp index 9605f6618ef..16be7c5eb40 100644 --- a/TAO/tao/IIOP_Transport.cpp +++ b/TAO/tao/IIOP_Transport.cpp @@ -32,10 +32,6 @@ TAO_IIOP_Transport::TAO_IIOP_Transport (TAO_IIOP_Connection_Handler *handler, , connection_handler_ (handler) , messaging_object_ (0) { - // We'll set the id_ (from TAO_Transport) to the handle from our connection - if (connection_handler_ != 0) - this->id_ = ACE_static_cast (int, this->connection_handler_->get_handle ()); - if (flag) { // Use the lite version of the protocol diff --git a/TAO/tao/IIOP_Transport.h b/TAO/tao/IIOP_Transport.h index 419c6481fa0..f882ef18ce2 100644 --- a/TAO/tao/IIOP_Transport.h +++ b/TAO/tao/IIOP_Transport.h @@ -61,11 +61,29 @@ public: /// Default destructor. ~TAO_IIOP_Transport (void); -#if 0 - /// The TAO_Transport methods, please check the documentation in - /// "tao/Pluggable.h" for more details. - virtual ACE_HANDLE handle (void); -#endif +protected: + /** @name Overridden Template Methods + * + * These are implementations of template methods declared by TAO_Transport. + */ + //@{ + + /// Access connection_handler_ as an ACE_Event_Handler. + /// Must be called with transport's lock held. + virtual ACE_Event_Handler *event_handler_i (void); + + /// Write the complete Message_Block chain to the connection. + /// Must be called with transport's lock held. + virtual ssize_t send_i (const ACE_Message_Block *mblk, + const ACE_Time_Value *s = 0, + size_t *bytes_transferred = 0); + + + /// Read len bytes from into buf. + /// Must be called with transport's lock held. + virtual ssize_t recv_i (char *buf, + size_t len, + const ACE_Time_Value *s = 0); /// Read and process the message from the connection. The processing /// of the message is done by delegating the work to the underlying @@ -73,6 +91,13 @@ public: virtual int read_process_message (ACE_Time_Value *max_time_value = 0, int block =0); + virtual int register_handler_i (void); + + /// Method to do whatever it needs to do when the connection + /// handler is being closed and destroyed. + virtual void transition_handler_state_i (void); + +public: /// @@TODO: These methods IMHO should have more meaningful /// names. The names seem to indicate nothing. virtual int send_request (TAO_Stub *stub, @@ -111,35 +136,7 @@ public: /// Open the service context list and process it. virtual int tear_listen_point_list (TAO_InputCDR &cdr); -protected: - /// Method to do whatever it needs to do when the connection - /// handler is being closed and destroyed. - virtual void transition_handler_state_i (void); - - /// Access connection_handler_ as an ACE_Event_Handler. - /// Must be called with transport's lock held. - virtual ACE_Event_Handler *event_handler_i (void); - - /// Write the complete Message_Block chain to the connection. - /// Must be called with transport's lock held. - virtual ssize_t send_i (const ACE_Message_Block *mblk, - const ACE_Time_Value *s = 0, - size_t *bytes_transferred = 0); - - - /// Read len bytes from into buf. - /// Must be called with transport's lock held. - virtual ssize_t recv_i (char *buf, - size_t len, - const ACE_Time_Value *s = 0); - - virtual int register_handler_i (void); - -#if 0 - /// Access the connection handler as TAO_Connection_Handler. - /// Must be called with transport's lock held. - virtual TAO_Connection_Handler* connection_handler_i (void) const; -#endif + //@} private: diff --git a/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp b/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp index 802e34af5d5..96320dfe48c 100644 --- a/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp +++ b/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp @@ -145,6 +145,9 @@ TAO_SHMIOP_Connection_Handler::activate (long flags, flags, THR_BOUND)); + // Set the id in the transport now that we're active. + this->transport ()->id (this->get_handle ()); + return TAO_SHMIOP_SVC_HANDLER::activate (flags, n_threads, force_active, diff --git a/TAO/tao/Strategies/SHMIOP_Connector.cpp b/TAO/tao/Strategies/SHMIOP_Connector.cpp index 4972f4505fe..4644ff6c698 100644 --- a/TAO/tao/Strategies/SHMIOP_Connector.cpp +++ b/TAO/tao/Strategies/SHMIOP_Connector.cpp @@ -158,14 +158,8 @@ TAO_SHMIOP_Connector::connect (TAO_Transport_Descriptor_Interface *desc, if (TAO_debug_level > 5) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) SHMIOP_Connector::connect ") - ACE_TEXT ("got an existing connection \n"))); - -#if 0 - // We have found a connection and a handler - svc_handler = - ACE_dynamic_cast (TAO_SHMIOP_Connection_Handler *, - base_transport->connection_handler ()); -#endif + ACE_TEXT ("got an existing transport with id %d \n"), + base_transport->id ())); } else { diff --git a/TAO/tao/Strategies/SHMIOP_Transport.cpp b/TAO/tao/Strategies/SHMIOP_Transport.cpp index 3ae9fd256ff..0702b07e05f 100644 --- a/TAO/tao/Strategies/SHMIOP_Transport.cpp +++ b/TAO/tao/Strategies/SHMIOP_Transport.cpp @@ -36,10 +36,6 @@ TAO_SHMIOP_Transport::TAO_SHMIOP_Transport (TAO_SHMIOP_Connection_Handler *handl connection_handler_ (handler), messaging_object_ (0) { - // We'll set the id_ (from TAO_Transport) to the handle from our connection - if (connection_handler_ != 0) - this->id_ = ACE_static_cast (int, this->connection_handler_->get_handle ()); - if (flag) { // Use the lite version of the protocol @@ -59,20 +55,6 @@ TAO_SHMIOP_Transport::~TAO_SHMIOP_Transport (void) delete this->messaging_object_; } -#if 0 -TAO_SHMIOP_SVC_HANDLER * -TAO_SHMIOP_Transport::service_handler (void) -{ - return this->connection_handler_; -} - -ACE_HANDLE -TAO_SHMIOP_Transport::handle (void) -{ - return this->connection_handler_->get_handle (); -} -#endif - ACE_Event_Handler * TAO_SHMIOP_Transport::event_handler_i (void) { @@ -404,12 +386,4 @@ TAO_SHMIOP_Transport::transition_handler_state_i (void) connection_handler_ = 0; } -#if 0 -TAO_Connection_Handler* -TAO_SHMIOP_Transport::connection_handler (void) const -{ - return connection_handler_; -} -#endif - #endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */ diff --git a/TAO/tao/Strategies/SHMIOP_Transport.h b/TAO/tao/Strategies/SHMIOP_Transport.h index 9e17ce40a51..5c6f4e84176 100644 --- a/TAO/tao/Strategies/SHMIOP_Transport.h +++ b/TAO/tao/Strategies/SHMIOP_Transport.h @@ -55,15 +55,6 @@ public: /// Default destructor. ~TAO_SHMIOP_Transport (void); -#if 0 - /// Return the connection service handler - TAO_SHMIOP_SVC_HANDLER *service_handler (void); - - /// The TAO_Transport methods, please check the documentation in - /// "tao/Pluggable.h" for more details. - virtual ACE_HANDLE handle (void); -#endif - protected: /** @name Overridden Template Methods * @@ -136,20 +127,13 @@ public: /// signalling. virtual int reactor_signalling (void); -#if 0 - // Access the connection handler - virtual TAO_Connection_Handler* connection_handler (void) const; -#endif - //@} private: - /// Process the message that we have read int process_message (void); private: - /// The connection service handler used for accessing lower layer /// communication protocols. TAO_SHMIOP_Connection_Handler *connection_handler_; diff --git a/TAO/tao/Strategies/UIOP_Connection_Handler.cpp b/TAO/tao/Strategies/UIOP_Connection_Handler.cpp index 37c252530ca..f17c384286e 100644 --- a/TAO/tao/Strategies/UIOP_Connection_Handler.cpp +++ b/TAO/tao/Strategies/UIOP_Connection_Handler.cpp @@ -127,6 +127,9 @@ TAO_UIOP_Connection_Handler::activate (long flags, flags, THR_BOUND)); + // Set the id in the transport now that we're active. + this->transport ()->id (this->get_handle ()); + return TAO_UIOP_SVC_HANDLER::activate (flags, n_threads, force_active, diff --git a/TAO/tao/Strategies/UIOP_Connector.cpp b/TAO/tao/Strategies/UIOP_Connector.cpp index a7be91097bf..61c328b3863 100644 --- a/TAO/tao/Strategies/UIOP_Connector.cpp +++ b/TAO/tao/Strategies/UIOP_Connector.cpp @@ -165,14 +165,8 @@ TAO_UIOP_Connector::connect (TAO_Transport_Descriptor_Interface *desc, if (TAO_debug_level > 5) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) UIOP_Connector::connect ") - ACE_TEXT ("got an existing connection \n"))); - -#if 0 - // We have found a connection and a handler - svc_handler = - ACE_dynamic_cast (TAO_UIOP_Connection_Handler *, - base_transport->connection_handler ()); -#endif + ACE_TEXT ("got an existing transport with id %d \n"), + base_transport->id ())); } else { diff --git a/TAO/tao/Strategies/UIOP_Transport.cpp b/TAO/tao/Strategies/UIOP_Transport.cpp index fb5aa9f8c13..5a438d9f994 100644 --- a/TAO/tao/Strategies/UIOP_Transport.cpp +++ b/TAO/tao/Strategies/UIOP_Transport.cpp @@ -36,10 +36,6 @@ TAO_UIOP_Transport::TAO_UIOP_Transport (TAO_UIOP_Connection_Handler *handler, , connection_handler_ (handler) , messaging_object_ (0) { - // We'll set the id_ (from TAO_Transport) to the handle from our connection - if (connection_handler_ != 0) - this->id_ = ACE_static_cast (int, this->connection_handler_->get_handle ()); - if (flag) { // Use the lite version of the protocol @@ -59,20 +55,6 @@ TAO_UIOP_Transport::~TAO_UIOP_Transport (void) delete this->messaging_object_; } -#if 0 -TAO_UIOP_SVC_HANDLER * -TAO_UIOP_Transport::service_handler (void) -{ - return this->connection_handler_; -} - -ACE_HANDLE -TAO_UIOP_Transport::handle (void) -{ - return this->connection_handler_->get_handle (); -} -#endif - ACE_Event_Handler * TAO_UIOP_Transport::event_handler_i (void) { @@ -398,12 +380,4 @@ TAO_UIOP_Transport::transition_handler_state_i (void) connection_handler_ = 0; } -#if 0 -TAO_Connection_Handler* -TAO_UIOP_Transport::connection_handler (void) const -{ - return connection_handler_; -} -#endif - #endif /* TAO_HAS_UIOP */ diff --git a/TAO/tao/Strategies/UIOP_Transport.h b/TAO/tao/Strategies/UIOP_Transport.h index ca850a497b1..b95eeec6e89 100644 --- a/TAO/tao/Strategies/UIOP_Transport.h +++ b/TAO/tao/Strategies/UIOP_Transport.h @@ -60,15 +60,6 @@ public: /// Default destructor. ~TAO_UIOP_Transport (void); -#if 0 - /// Return the connection service handler - TAO_UIOP_SVC_HANDLER *service_handler (void); - - /// The TAO_Transport methods, please check the documentation in - /// "tao/Pluggable.h" for more details. - virtual ACE_HANDLE handle (void); -#endif - protected: /** @name Overridden Template Methods * @@ -137,11 +128,6 @@ public: virtual int messaging_init (CORBA::Octet major, CORBA::Octet minor); -#if 0 - // Access the connection handler - virtual TAO_Connection_Handler* connection_handler (void) const; -#endif - //@} private: diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp index f1863fe3f8f..c58fddc97c1 100644 --- a/TAO/tao/Transport.cpp +++ b/TAO/tao/Transport.cpp @@ -92,13 +92,11 @@ TAO_Transport::send_or_buffer (TAO_Stub *stub, const ACE_Message_Block *message_block, const ACE_Time_Value *max_wait_time) { - ACE_MT (ACE_GUARD_RETURN (ACE_Lock, - guard, - *this->handler_lock_, - -1)); if (stub == 0 || two_way) - return this->send_i (message_block, max_wait_time); + { + return this->send (message_block, max_wait_time); + } TAO_Sync_Strategy &sync_strategy = stub->sync_strategy (); @@ -483,7 +481,14 @@ TAO_Transport::register_handler (void) } int -TAO_Transport::id (void) +TAO_Transport::id (void) const { return this->id_; } + +void +TAO_Transport::id (int id) +{ + this->id_ = id; +} + diff --git a/TAO/tao/Transport.h b/TAO/tao/Transport.h index c8b9137ff9f..4feb9dccaed 100644 --- a/TAO/tao/Transport.h +++ b/TAO/tao/Transport.h @@ -359,12 +359,15 @@ public: const ACE_Time_Value *timeout = 0); - /// Return a unique identifier for this transport instance. + /// Return the identifier for this transport instance. /** - * It's established at construction, and not changed throughout the life - * of a transport. + * If not set, this will return an integer representation of + * the this pointer for the instance on which + * it's called. */ - virtual int id (void); + int id (void) const; + /// Set the identifier for this transport instance. + void id (int id); protected: /** @name Template methods @@ -376,20 +379,6 @@ protected: */ //@{ -#if 0 - /// Return the file descriptor used for this connection. - /** - * @todo Someday we should be able to support protocols that do not - * have or use file descriptors. But this will require implementing - * non-reactive concurrency models for some connections. Really - * hard to do. Meanwhile, look at the SHMIOP protocol for an - * example on how to use file descriptors for signalling while the - * actual data is transfer via shared memory (where there are no - * file descriptors.) - */ - virtual ACE_HANDLE handle (void) = 0; -#endif - /// Return the event handler used to receive notifications from the /// Reactor. /** @@ -645,12 +634,6 @@ public: int make_idle (void); protected: -#if 0 - // Access the connection handler - // @@CJC Do we still need this?! - virtual TAO_Connection_Handler* connection_handler_i (void) const; -#endif - // @@ see if one of these calls send_message() /// Remove the first message from the outgoing queue. void dequeue_head (void); -- cgit v1.2.1