diff options
Diffstat (limited to 'TAO/tao/Block_Flushing_Strategy.cpp')
-rw-r--r-- | TAO/tao/Block_Flushing_Strategy.cpp | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/TAO/tao/Block_Flushing_Strategy.cpp b/TAO/tao/Block_Flushing_Strategy.cpp index 397e4717006..ce17445599d 100644 --- a/TAO/tao/Block_Flushing_Strategy.cpp +++ b/TAO/tao/Block_Flushing_Strategy.cpp @@ -3,6 +3,8 @@ #include "tao/Block_Flushing_Strategy.h" #include "tao/Transport.h" #include "tao/Queued_Message.h" +#include "tao/Connection_Handler.h" +#include "ace/Countdown_Time.h" ACE_RCSID(tao, Block_Flushing_Strategy, "$Id$") @@ -21,15 +23,37 @@ TAO_Block_Flushing_Strategy::cancel_output (TAO_Transport *) } int +TAO_Block_Flushing_Strategy::call_handle_output (TAO_Transport *transport, + const TAO::Transport::Drain_Constraints &dc) +{ + switch (transport->handle_output (dc).dre_) + { + case TAO_Transport::DR_ERROR: return -1; + case TAO_Transport::DR_QUEUE_EMPTY: // won't happen, fall-through anyway + case TAO_Transport::DR_OK: return 0; + case TAO_Transport::DR_WOULDBLOCK: + { + ACE_Countdown_Time counter (dc.timeout ()); + TAO_Connection_Handler &ch = *transport->connection_handler (); + if (ch.handle_write_ready (dc.timeout ()) == -1) + { + return -1; + } + return 0; + } + } + return 0; +} + +int TAO_Block_Flushing_Strategy::flush_message (TAO_Transport *transport, TAO_Queued_Message *msg, ACE_Time_Value *max_wait_time) { + TAO::Transport::Drain_Constraints dc (max_wait_time, true); while (!msg->all_data_sent ()) { - TAO::Transport::Drain_Constraints dc( - max_wait_time, true); - if (transport->handle_output (dc) == -1) + if (this->call_handle_output (transport, dc) == -1) return -1; } return 0; @@ -39,11 +63,10 @@ int TAO_Block_Flushing_Strategy::flush_transport (TAO_Transport *transport, ACE_Time_Value *max_wait_time) { + TAO::Transport::Drain_Constraints dc (max_wait_time, true); while (!transport->queue_is_empty ()) { - TAO::Transport::Drain_Constraints dc( - max_wait_time, true); - if (transport->handle_output (dc) == -1) + if (this->call_handle_output (transport, dc) == -1) return -1; } return 0; |