Updated logging to include the class/method so that it is more obvious where these...
[ACE_TAO.git] / TAO / tao / Reactive_Flushing_Strategy.cpp
blobf7bff78c6c2dc3bd81d3d65cbca9f007ab2447e3
1 // -*- C++ -*-
2 #include "tao/Reactive_Flushing_Strategy.h"
3 #include "tao/Transport.h"
4 #include "tao/ORB_Core.h"
5 #include "tao/Queued_Message.h"
7 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
9 int
10 TAO_Reactive_Flushing_Strategy::schedule_output (TAO_Transport *transport)
12 return transport->schedule_output_i ();
15 int
16 TAO_Reactive_Flushing_Strategy::cancel_output (TAO_Transport *transport)
18 return transport->cancel_output_i ();
21 int
22 TAO_Reactive_Flushing_Strategy::flush_message (TAO_Transport *transport,
23 TAO_Queued_Message *msg,
24 ACE_Time_Value *max_wait_time)
26 int result = 0;
28 // @@ Should we pass this down? Can we?
29 try
31 TAO_ORB_Core * const orb_core = transport->orb_core ();
33 while (!msg->all_data_sent () && result >= 0)
35 result = orb_core->run (max_wait_time, 1);
37 if (max_wait_time != nullptr) {
38 if (*max_wait_time <= ACE_Time_Value::zero) {
39 errno = ETIME;
40 result = -1;
45 catch (const ::CORBA::Exception&)
47 return -1;
50 return result;
53 int
54 TAO_Reactive_Flushing_Strategy::flush_transport (TAO_Transport *transport
55 , ACE_Time_Value *max_wait_time)
57 try
59 TAO_ORB_Core * const orb_core = transport->orb_core ();
61 while (!transport->queue_is_empty ())
63 if (orb_core->run (max_wait_time, 1) == -1)
64 return -1;
66 if (max_wait_time != nullptr) {
67 if (*max_wait_time <= ACE_Time_Value::zero) {
68 errno = ETIME;
69 return -1;
74 catch (const ::CORBA::Exception&)
76 return -1;
79 return 0;
82 TAO_END_VERSIONED_NAMESPACE_DECL