s/Uint/UInt/g
[ACE_TAO.git] / TAO / tao / Block_Flushing_Strategy.cpp
blob4ca3d7435dd478ff0520591a15835e234af8ae9c
1 #include "tao/Block_Flushing_Strategy.h"
2 #include "tao/Transport.h"
3 #include "tao/Queued_Message.h"
4 #include "tao/Connection_Handler.h"
5 #include "tao/ORB_Time_Policy.h"
7 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
9 int
10 TAO_Block_Flushing_Strategy::schedule_output (TAO_Transport *)
12 return MUST_FLUSH;
15 int
16 TAO_Block_Flushing_Strategy::cancel_output (TAO_Transport *)
18 return 0;
21 int
22 TAO_Block_Flushing_Strategy::call_handle_output (TAO_Transport *transport,
23 const TAO::Transport::Drain_Constraints &dc)
25 switch (transport->handle_output (dc).dre_)
27 case TAO_Transport::DR_ERROR: return -1;
28 case TAO_Transport::DR_QUEUE_EMPTY: // won't happen, fall-through anyway
29 case TAO_Transport::DR_OK: return 0;
30 case TAO_Transport::DR_WOULDBLOCK:
32 TAO::ORB_Countdown_Time counter (dc.timeout ());
33 TAO_Connection_Handler &ch = *transport->connection_handler ();
34 if (ch.handle_write_ready (dc.timeout ()) == -1)
36 return -1;
38 return 0;
41 return 0;
44 int
45 TAO_Block_Flushing_Strategy::flush_message (TAO_Transport *transport,
46 TAO_Queued_Message *msg,
47 ACE_Time_Value *max_wait_time)
49 TAO::Transport::Drain_Constraints dc (max_wait_time, true);
50 while (!msg->all_data_sent ())
52 if (this->call_handle_output (transport, dc) == -1)
53 return -1;
55 return 0;
58 int
59 TAO_Block_Flushing_Strategy::flush_transport (TAO_Transport *transport,
60 ACE_Time_Value *max_wait_time)
62 TAO::Transport::Drain_Constraints dc (max_wait_time, true);
63 while (!transport->queue_is_empty ())
65 if (this->call_handle_output (transport, dc) == -1)
66 return -1;
68 return 0;
71 TAO_END_VERSIONED_NAMESPACE_DECL