From 7018a2dc7f818edbe6d6e287888d6b43f27fd983 Mon Sep 17 00:00:00 2001 From: johnc Date: Thu, 7 Feb 2008 22:58:21 +0000 Subject: ChangeLogTag: Thu Feb 7 22:49:48 UTC 2008 Ciju John --- TAO/ChangeLog | 16 ++++++++++++++++ TAO/tao/Leader_Follower_Flushing_Strategy.cpp | 10 +--------- TAO/tao/Reactive_Flushing_Strategy.cpp | 17 ++++++++++++++++- TAO/tao/Strategies/DIOP_Transport.cpp | 24 ------------------------ TAO/tao/Strategies/DIOP_Transport.h | 5 ----- TAO/tao/Strategies/SCIOP_Transport.cpp | 23 ----------------------- TAO/tao/Strategies/SCIOP_Transport.h | 5 ----- TAO/tests/Oneway_Send_Timeouts/run_test.pl | 5 ++++- 8 files changed, 37 insertions(+), 68 deletions(-) diff --git a/TAO/ChangeLog b/TAO/ChangeLog index c0c3e0ef619..dfb2860a611 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,19 @@ +Thu Feb 7 22:49:48 UTC 2008 Ciju John + + * tao/Leader_Follower_Flushing_Strategy.cpp: + * tao/Reactive_Flushing_Strategy.cpp: + Check for timeout in flush_message and flush_transport API's. If + hit set errno appropriately and return -1, informing higher layer. + + * tao/Strategies/DIOP_Transport.h: + * tao/Strategies/DIOP_Transport.cpp: + * tao/Strategies/SCIOP_Transport.h: + * tao/Strategies/SCIOP_Transport.cpp: + Chop out replicated code. + + * tests/Oneway_Send_Timeouts/run_test.pl: + Extend test for reactive flushing. + Tue Feb 5 22:50:16 UTC 2008 Ciju John * tests/Oneway_Send_Timeouts/Client.h: diff --git a/TAO/tao/Leader_Follower_Flushing_Strategy.cpp b/TAO/tao/Leader_Follower_Flushing_Strategy.cpp index b8998716d8f..cae30a967ba 100644 --- a/TAO/tao/Leader_Follower_Flushing_Strategy.cpp +++ b/TAO/tao/Leader_Follower_Flushing_Strategy.cpp @@ -45,25 +45,17 @@ TAO_Leader_Follower_Flushing_Strategy::flush_transport ( TAO_Transport *transport, ACE_Time_Value *max_wait_time) { - // @todo This is not the right way to do this.... - try { TAO_ORB_Core * const orb_core = transport->orb_core (); - ACE_Time_Value current = ACE_High_Res_Timer::gettimeofday_hr (); - ACE_Time_Value timeout; - if (max_wait_time != 0) { - timeout = current + *max_wait_time; - } while (!transport->queue_is_empty ()) { if (orb_core->run (max_wait_time, 1) == -1) return -1; if (max_wait_time != 0) { - current = ACE_High_Res_Timer::gettimeofday_hr (); - if (current >= timeout) { + if (*max_wait_time <= ACE_Time_Value::zero) { errno = ETIME; return -1; } diff --git a/TAO/tao/Reactive_Flushing_Strategy.cpp b/TAO/tao/Reactive_Flushing_Strategy.cpp index 13060233926..9a9bb0f4954 100644 --- a/TAO/tao/Reactive_Flushing_Strategy.cpp +++ b/TAO/tao/Reactive_Flushing_Strategy.cpp @@ -6,6 +6,8 @@ #include "tao/ORB_Core.h" #include "tao/Queued_Message.h" +#include "ace/High_Res_Timer.h" + ACE_RCSID (tao, Reactive_Flushing_Strategy, "$Id$") @@ -40,6 +42,13 @@ TAO_Reactive_Flushing_Strategy::flush_message (TAO_Transport *transport, while (!msg->all_data_sent () && result >= 0) { result = orb_core->run (max_wait_time, 1); + + if (max_wait_time != 0) { + if (*max_wait_time <= ACE_Time_Value::zero) { + errno = ETIME; + result = -1; + } + } } } catch (const ::CORBA::Exception&) @@ -54,7 +63,6 @@ int TAO_Reactive_Flushing_Strategy::flush_transport (TAO_Transport *transport , ACE_Time_Value *max_wait_time) { - // @@ Should we pass this down? Can we? try { TAO_ORB_Core * const orb_core = transport->orb_core (); @@ -63,6 +71,13 @@ TAO_Reactive_Flushing_Strategy::flush_transport (TAO_Transport *transport { if (orb_core->run (max_wait_time, 1) == -1) return -1; + + if (max_wait_time != 0) { + if (*max_wait_time <= ACE_Time_Value::zero) { + errno = ETIME; + return -1; + } + } } } catch (const ::CORBA::Exception&) diff --git a/TAO/tao/Strategies/DIOP_Transport.cpp b/TAO/tao/Strategies/DIOP_Transport.cpp index 535ce2a53a6..e8e504c9e4f 100644 --- a/TAO/tao/Strategies/DIOP_Transport.cpp +++ b/TAO/tao/Strategies/DIOP_Transport.cpp @@ -279,30 +279,6 @@ TAO_DIOP_Transport::send_message (TAO_OutputCDR &stream, return 1; } -int -TAO_DIOP_Transport::send_message_shared (TAO_Stub *stub, - TAO_Message_Semantics message_semantics, - const ACE_Message_Block *message_block, - ACE_Time_Value *max_wait_time) -{ - int result; - - { - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1); - - result = - this->send_message_shared_i (stub, message_semantics, - message_block, max_wait_time); - } - - if (result == -1) - { - this->close_connection (); - } - - return result; -} - TAO_END_VERSIONED_NAMESPACE_DECL #endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */ diff --git a/TAO/tao/Strategies/DIOP_Transport.h b/TAO/tao/Strategies/DIOP_Transport.h index ba3363dfdcf..857a22884cc 100644 --- a/TAO/tao/Strategies/DIOP_Transport.h +++ b/TAO/tao/Strategies/DIOP_Transport.h @@ -84,11 +84,6 @@ protected: size_t len, const ACE_Time_Value *s = 0); - virtual int send_message_shared (TAO_Stub *stub, - TAO_Message_Semantics message_semantics, - const ACE_Message_Block *message_block, - ACE_Time_Value *max_wait_time); - virtual int register_handler (void); ///@} diff --git a/TAO/tao/Strategies/SCIOP_Transport.cpp b/TAO/tao/Strategies/SCIOP_Transport.cpp index 903ccf22922..0d0e9f1024b 100644 --- a/TAO/tao/Strategies/SCIOP_Transport.cpp +++ b/TAO/tao/Strategies/SCIOP_Transport.cpp @@ -159,29 +159,6 @@ TAO_SCIOP_Transport::send_message (TAO_OutputCDR &stream, return 1; } -int -TAO_SCIOP_Transport::send_message_shared (TAO_Stub *stub, - TAO_Message_Semantics message_semantics, - const ACE_Message_Block *message_block, - ACE_Time_Value *max_wait_time) -{ - int r; - - { - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->handler_lock_, -1); - - r = this->send_message_shared_i (stub, message_semantics, - message_block, max_wait_time); - } - - if (r == -1) - { - this->close_connection (); - } - - return r; -} - int TAO_SCIOP_Transport::generate_request_header (TAO_Operation_Details &opdetails, TAO_Target_Specification &spec, diff --git a/TAO/tao/Strategies/SCIOP_Transport.h b/TAO/tao/Strategies/SCIOP_Transport.h index 6838be27c87..b29fc6ef68b 100644 --- a/TAO/tao/Strategies/SCIOP_Transport.h +++ b/TAO/tao/Strategies/SCIOP_Transport.h @@ -78,11 +78,6 @@ protected: size_t len, const ACE_Time_Value *s = 0); - virtual int send_message_shared (TAO_Stub *stub, - TAO_Message_Semantics message_semantics, - const ACE_Message_Block *message_block, - ACE_Time_Value *max_wait_time); - public: /// @todo These methods IMHO should have more meaningful diff --git a/TAO/tests/Oneway_Send_Timeouts/run_test.pl b/TAO/tests/Oneway_Send_Timeouts/run_test.pl index 4846b2b0768..e627a9dde78 100755 --- a/TAO/tests/Oneway_Send_Timeouts/run_test.pl +++ b/TAO/tests/Oneway_Send_Timeouts/run_test.pl @@ -23,6 +23,10 @@ foreach $i (@ARGV) { $client_conf = "block_flush.conf"; $flush_strategy = "BLOCKING"; } + elsif ($i eq '-reactive') { + $client_conf = "reactive_flush.conf"; + $flush_strategy = "REACTIVE"; + } else { print STDERR "ERROR: Unknown option: $i\n"; exit 1; @@ -32,7 +36,6 @@ foreach $i (@ARGV) { my $test_opts = "-s \'-ORBEndpoint iiop://localhost:$test_port -ORBEndpoint " . "iiop://localhost:$management_port -ORBDebuglevel $debug_level -ORBCollocation " . "no -ORBGestalt LOCAL\' -c \'-k corbaloc::localhost:$test_port/Test -b " . - #"no\' -c \'-k corbaloc::localhost:$test_port/Test -b " . "corbaloc::localhost:$management_port/Management -ORBDebuglevel $debug_level " . "-ORBCollocation no -1 -ORBSvcConf $client_conf -f $flush_strategy " . "-ORBGestalt LOCAL\'"; -- cgit v1.2.1