diff options
20 files changed, 79 insertions, 146 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index f743422eb12..019e547b752 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,37 @@ +Tue Apr 24 12:48:19 2001 Carlos O'Ryan <coryan@uci.edu> + + * tao/Transport.h: + * tao/Transport.cpp: + Fixed dead-lock in the timeout management. + + * docs/Options.html: + Documented new option to control the flushing strategy (blocking + vs. reactive) + + * tao/Asynch_Queued_Message.cpp: + Fixed warnings about unused variable. + + * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h: + * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp: + * examples/PluggableUDP/DIOP/DIOP_Connection_Handler.h: + * examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp: + * tao/Strategies/SHMIOP_Connection_Handler.h: + * tao/Strategies/SHMIOP_Connection_Handler.cpp: + * tao/Strategies/UIOP_Connection_Handler.h: + * tao/Strategies/UIOP_Connection_Handler.cpp: + * tao/IIOP_Connection_Handler.h: + * tao/IIOP_Connection_Handler.cpp: + Removed unused handle_timeout() methods. The code has been + factored out into the TAO_Transport_Timer class. + + * tao/Transport_Timer.h: + * tao/Asynch_Timeout_Handler.h: + * tao/Synch_Queued_Message.cpp: + Cosmetic fixes + + * examples/Buffered_Oneways/test.idl: + Made shutdown operation a twoway. + Tue Apr 24 11:59:04 2001 Carlos O'Ryan <coryan@uci.edu> * tests/LongWrites/Sender.h: diff --git a/TAO/docs/Options.html b/TAO/docs/Options.html index 72bc04efbb7..86a2c7fd10d 100644 --- a/TAO/docs/Options.html +++ b/TAO/docs/Options.html @@ -528,6 +528,17 @@ superseded by <code><A HREF="#-ORBReactorType">-ORBReactorType</A></code>. </TD> </TR> <TR> + <TD><CODE>-ORBFlushingStrategy</CODE> <EM>type</EM></TD> + <TD><a name="-ORBFlshingStrategy"></a> + By default TAO provides two strategies to flush queued messages. + The <CODE>reactive</CODE> strategy uses the Reactor and + non-blocking I/O to drain the queue. + In contrast, the <CODE>blocking</CODE> strategy flushes the + queue as soon as it becomes "full", and blocks the + thread until all the data is sent. + </TD> +</TR> +<TR> <TD><CODE>-ORBSchedPolicy</CODE> <EM>policy</EM></TD> <TD><a name="-ORBSchedPolicy"></a> Specify the scheduling policy used for the priority mapping diff --git a/TAO/examples/Buffered_Oneways/test.idl b/TAO/examples/Buffered_Oneways/test.idl index a324dca820f..460fe5b6cac 100644 --- a/TAO/examples/Buffered_Oneways/test.idl +++ b/TAO/examples/Buffered_Oneways/test.idl @@ -6,5 +6,5 @@ interface test { oneway void method (in unsigned long request_number); - oneway void shutdown (); + void shutdown (); }; diff --git a/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp b/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp index 8afe2b82c74..49699687f17 100644 --- a/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp +++ b/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.cpp @@ -256,20 +256,6 @@ TAO_DIOP_Connection_Handler::fetch_handle (void) int -TAO_DIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &, - const void *) -{ - // Cannot deal with errors, and therefore they are ignored. - if (this->transport ()->handle_output () == -1) - { - return -1; - } - - return 0; -} - - -int TAO_DIOP_Connection_Handler::add_transport_to_cache (void) { ACE_INET_Addr addr; diff --git a/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.h b/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.h index abdc19b8d1f..03356526237 100644 --- a/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.h +++ b/TAO/examples/PluggableUDP/DIOP/DIOP_Connection_Handler.h @@ -114,10 +114,6 @@ public: /// Return the underlying handle virtual ACE_HANDLE fetch_handle (void); - /// Called when buffering timer expires. - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg = 0); - /// Add ourselves to Cache. int add_transport_to_cache (void); diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp index 2c62bcceb72..950cfc2a359 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.cpp @@ -226,17 +226,6 @@ TAO_SSLIOP_Connection_Handler::fetch_handle (void) int -TAO_SSLIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &, - const void *) -{ - // Cannot deal with errors, and therefore they are ignored. - if (this->transport ()->handle_output () == -1) - return -1; - - return 0; -} - -int TAO_SSLIOP_Connection_Handler::handle_output (ACE_HANDLE) { return this->transport ()->handle_output (); diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h index aaeab6f4a24..7844e35bc69 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Connection_Handler.h @@ -97,10 +97,6 @@ public: /// Return the underlying handle virtual ACE_HANDLE fetch_handle (void); - /// Called when buffering timer expires. - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg = 0); - /// Documented in ACE_Event_Handler virtual int handle_output (ACE_HANDLE); diff --git a/TAO/tao/Asynch_Queued_Message.cpp b/TAO/tao/Asynch_Queued_Message.cpp index b848b178a97..5fdafc28735 100644 --- a/TAO/tao/Asynch_Queued_Message.cpp +++ b/TAO/tao/Asynch_Queued_Message.cpp @@ -49,6 +49,7 @@ TAO_Asynch_Queued_Message::fill_iov (int iovcnt_max, iovec iov[]) const { ACE_ASSERT (iovcnt_max > iovcnt); + ACE_UNUSED_ARG (iovcnt_max); // not used if ACE_ASSERT() is empty iov[iovcnt].iov_base = this->buffer_ + this->offset_; iov[iovcnt].iov_len = this->size_ - this->offset_; diff --git a/TAO/tao/Asynch_Timeout_Handler.cpp b/TAO/tao/Asynch_Timeout_Handler.cpp index a0c6bf1ad24..b9e2c0beb4e 100644 --- a/TAO/tao/Asynch_Timeout_Handler.cpp +++ b/TAO/tao/Asynch_Timeout_Handler.cpp @@ -45,7 +45,7 @@ TAO_Asynch_Timeout_Handler::schedule_timer (TAO_Transport_Mux_Strategy *tms, max_wait_time); } -int +int TAO_Asynch_Timeout_Handler::handle_timeout (const ACE_Time_Value &, const void *) { diff --git a/TAO/tao/Asynch_Timeout_Handler.h b/TAO/tao/Asynch_Timeout_Handler.h index 2eb6d81dbcc..dfa5d16fc05 100644 --- a/TAO/tao/Asynch_Timeout_Handler.h +++ b/TAO/tao/Asynch_Timeout_Handler.h @@ -41,7 +41,7 @@ class TAO_Export TAO_Asynch_Timeout_Handler // TAO_Asynch_Timeout_Handler // // = DESCRIPTION - // Handler registered with the reactor in case of AMI + // Handler registered with the reactor in case of AMI // timeouts. // public: diff --git a/TAO/tao/IIOP_Connection_Handler.cpp b/TAO/tao/IIOP_Connection_Handler.cpp index 3073acd10a2..946610c5ddf 100644 --- a/TAO/tao/IIOP_Connection_Handler.cpp +++ b/TAO/tao/IIOP_Connection_Handler.cpp @@ -244,19 +244,6 @@ TAO_IIOP_Connection_Handler::fetch_handle (void) } int -TAO_IIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &, - const void *) -{ - // Cannot deal with errors, and therefore they are ignored. - if (this->transport ()->handle_output () == -1) - { - return -1; - } - - return 0; -} - -int TAO_IIOP_Connection_Handler::handle_output (ACE_HANDLE) { return this->transport ()->handle_output (); diff --git a/TAO/tao/IIOP_Connection_Handler.h b/TAO/tao/IIOP_Connection_Handler.h index 4a14d8a5d2d..da7add58446 100644 --- a/TAO/tao/IIOP_Connection_Handler.h +++ b/TAO/tao/IIOP_Connection_Handler.h @@ -111,10 +111,6 @@ public: /// Return the underlying handle virtual ACE_HANDLE fetch_handle (void); - /// Called when buffering timer expires. - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg = 0); - /// Documented in ACE_Event_Handler virtual int handle_output (ACE_HANDLE); diff --git a/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp b/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp index 50dc660bf8e..89d69faeea8 100644 --- a/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp +++ b/TAO/tao/Strategies/SHMIOP_Connection_Handler.cpp @@ -20,7 +20,7 @@ # include "SHMIOP_Connection_Handler.inl" #endif /* ! __ACE_INLINE__ */ -ACE_RCSID(Strategies, SHMIOP_Connect, "$Id$") +ACE_RCSID(Strategies, SHMIOP_Connection_Handler, "$Id$") TAO_SHMIOP_Connection_Handler::TAO_SHMIOP_Connection_Handler (ACE_Thread_Manager *t) : TAO_SHMIOP_SVC_HANDLER (t, 0 , 0), @@ -221,14 +221,9 @@ TAO_SHMIOP_Connection_Handler::fetch_handle (void) } int -TAO_SHMIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &, - const void *) +TAO_SHMIOP_Connection_Handler::handle_output (ACE_HANDLE) { - // Cannot deal with errors, and therefore they are ignored. - if (this->transport ()->handle_output () == -1) - return -1; - - return 0; + return this->transport ()->handle_output (); } int diff --git a/TAO/tao/Strategies/SHMIOP_Connection_Handler.h b/TAO/tao/Strategies/SHMIOP_Connection_Handler.h index bc724fbc887..cf9c2fe3549 100644 --- a/TAO/tao/Strategies/SHMIOP_Connection_Handler.h +++ b/TAO/tao/Strategies/SHMIOP_Connection_Handler.h @@ -87,9 +87,8 @@ public: /// Return the underlying handle virtual ACE_HANDLE fetch_handle (void); - /// Called when buffering timer expires. - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg = 0); + /// Documented in ACE_Event_Handler + virtual int handle_output (ACE_HANDLE); /// Add ourselves to Cache. int add_transport_to_cache (void); diff --git a/TAO/tao/Strategies/UIOP_Connection_Handler.cpp b/TAO/tao/Strategies/UIOP_Connection_Handler.cpp index 9b16ca2a6dc..a74dbe275c7 100644 --- a/TAO/tao/Strategies/UIOP_Connection_Handler.cpp +++ b/TAO/tao/Strategies/UIOP_Connection_Handler.cpp @@ -202,17 +202,6 @@ TAO_UIOP_Connection_Handler::fetch_handle (void) int -TAO_UIOP_Connection_Handler::handle_timeout (const ACE_Time_Value &, - const void *) -{ - // Cannot deal with errors, and therefore they are ignored. - if (this->transport ()->handle_output () == -1) - return -1; - - return 0; -} - -int TAO_UIOP_Connection_Handler::add_transport_to_cache (void) { ACE_UNIX_Addr addr; diff --git a/TAO/tao/Strategies/UIOP_Connection_Handler.h b/TAO/tao/Strategies/UIOP_Connection_Handler.h index 0b652400052..3432fd3b9ae 100644 --- a/TAO/tao/Strategies/UIOP_Connection_Handler.h +++ b/TAO/tao/Strategies/UIOP_Connection_Handler.h @@ -106,10 +106,6 @@ public: /// Return the underlying handle virtual ACE_HANDLE fetch_handle (void); - /// Called when buffering timer expires. - virtual int handle_timeout (const ACE_Time_Value &tv, - const void *arg = 0); - /// Add ourselves to Cache. int add_transport_to_cache (void); diff --git a/TAO/tao/Synch_Queued_Message.cpp b/TAO/tao/Synch_Queued_Message.cpp index b65fd572408..7d62c69468a 100644 --- a/TAO/tao/Synch_Queued_Message.cpp +++ b/TAO/tao/Synch_Queued_Message.cpp @@ -68,7 +68,7 @@ TAO_Synch_Queued_Message::bytes_transferred (size_t &byte_count) while (this->current_block_ != 0 && byte_count > 0) { size_t l = this->current_block_->length (); - + if (byte_count < l) { this->current_block_->rd_ptr (byte_count); diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp index d0755e59eef..db05799a536 100644 --- a/TAO/tao/Transport.cpp +++ b/TAO/tao/Transport.cpp @@ -144,20 +144,6 @@ TAO_Transport::handle_output () flushing_strategy->cancel_output (this); - if (this->flush_timer_id_ != -1) - { - ACE_Event_Handler *eh = this->event_handler_i (); - if (eh != 0) - { - ACE_Reactor *reactor = eh->reactor (); - if (reactor != 0) - { - (void) reactor->cancel_timer (this->flush_timer_id_); - } - } - this->current_deadline_ = ACE_Time_Value::zero; - this->flush_timer_id_ = -1; - } return 0; } @@ -747,24 +733,6 @@ TAO_Transport::generate_request_header ( return 0; } - -long -TAO_Transport::register_for_timer_event (const void* arg, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval) -{ - ACE_MT (ACE_GUARD_RETURN (ACE_Lock, - guard, - *this->handler_lock_, - -1)); - - ACE_Event_Handler *eh = this->event_handler_i (); - if (eh == 0) - return -1; - - return this->orb_core_->reactor ()->schedule_timer (eh, arg, delay, interval); -} - int TAO_Transport::queue_is_empty (void) { @@ -846,6 +814,13 @@ int TAO_Transport::handle_timeout (const ACE_Time_Value & /* current_time */, const void *act) { + if (TAO_debug_level > 6) + { + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - TAO_Transport::handle_timeout, " + "timer expired\n")); + } + /// This is the only legal ACT in the current configuration.... if (act != &this->current_deadline_) return -1; @@ -935,9 +910,6 @@ TAO_Transport::drain_queue_helper (int &iovcnt, iovec iov[]) int TAO_Transport::drain_queue_i (void) { - if (this->head_ == 0) - return 1; - // This is the vector used to send data, it must be declared outside // the loop because after the loop there may still be data to be // sent @@ -995,7 +967,22 @@ TAO_Transport::drain_queue_i (void) } if (this->head_ == 0) - return 1; + { + if (this->flush_timer_pending ()) + { + ACE_Event_Handler *eh = this->event_handler_i (); + if (eh != 0) + { + ACE_Reactor *reactor = eh->reactor (); + if (reactor != 0) + { + (void) reactor->cancel_timer (this->flush_timer_id_); + } + } + this->reset_flush_timer (); + } + return 1; + } return 0; } @@ -1064,11 +1051,6 @@ TAO_Transport::check_buffering_constraints_i (TAO_Stub *stub, // ... set the new timer, also cancel any previous timers ... if (set_timer) { - ACE_MT (ACE_GUARD_RETURN (ACE_Lock, - guard, - *this->handler_lock_, - -1)); - ACE_Event_Handler *eh = this->event_handler_i (); if (eh != 0) { diff --git a/TAO/tao/Transport.h b/TAO/tao/Transport.h index f4ec1fefb62..04ec3c06c71 100644 --- a/TAO/tao/Transport.h +++ b/TAO/tao/Transport.h @@ -538,30 +538,6 @@ public: /// is being closed and destroyed. virtual void connection_handler_closing (void); - /// Register the associated connection handler with the reactor - /// for a timer. - /** - * At this point, only - * <code>TAO_Eager_Buffering_Sync_Strategy::timer_check()</code> - * uses this, and it's unclear whether it needs to stay around. - * But, it's here because it uses the associated protocol-specific - * connection handler, and accesses to that must be serialized on - * the internal lock. - * - * @param arg argument passed to the handle_timeout() method of the - * event handler - * @param delay time interval after which the timer will expire - * @param interval time interval after which the timer will be - * automatically rescheduled - * @return -1 on failure, a Reactor timer_id value on success - * - * @see ACE_Reactor::schedule_timer() - * @see TAO_Eager_Buffering_Sync_Strategy::timer_check() - */ - long register_for_timer_event (const void* arg, - const ACE_Time_Value &delay, - const ACE_Time_Value &interval = ACE_Time_Value::zero); - // Maintain reference counting with these static TAO_Transport* _duplicate (TAO_Transport* transport); static void release (TAO_Transport* transport); diff --git a/TAO/tao/Transport_Timer.h b/TAO/tao/Transport_Timer.h index e1e2d7b070c..b93510248e2 100644 --- a/TAO/tao/Transport_Timer.h +++ b/TAO/tao/Transport_Timer.h @@ -42,7 +42,7 @@ public: TAO_Transport_Timer (TAO_Transport *transport); /// Receive timeout events from the Reactor and forward them to the - /// TAO_Transport + /// TAO_Transport virtual int handle_timeout (const ACE_Time_Value ¤t_time, const void *act); private: |