1 #include "tao/Wait_On_Reactor.h"
2 #include "tao/ORB_Core.h"
3 #include "tao/Transport.h"
4 #include "tao/Synch_Reply_Dispatcher.h"
5 #include "tao/ORB_Time_Policy.h"
7 #include "ace/Reactor.h"
9 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
11 TAO_Wait_On_Reactor::TAO_Wait_On_Reactor (TAO_Transport
*transport
)
12 : TAO_Wait_Strategy (transport
)
17 TAO_Wait_On_Reactor::wait (ACE_Time_Value
*max_wait_time
,
18 TAO_Synch_Reply_Dispatcher
&rd
)
20 // Start the count down timer to account for the time spent in this
22 TAO::ORB_Countdown_Time
countdown (max_wait_time
);
24 // Reactor does not change inside the loop.
25 ACE_Reactor
*const reactor
=
26 this->transport_
->orb_core ()->reactor ();
28 TAO_Leader_Follower
&leader_follower
=
29 this->transport_
->orb_core ()->leader_follower ();
31 // Do the event loop, till we fully receive a reply.
36 // Run the event loop.
37 result
= reactor
->handle_events (max_wait_time
);
39 // If we got our reply, no need to run the event loop any
41 if (!rd
.keep_waiting (leader_follower
))
46 // Did we timeout? If so, stop running the loop.
48 && max_wait_time
!= nullptr
49 && *max_wait_time
== ACE_Time_Value::zero
)
54 // Other errors? If so, stop running the loop.
60 // Otherwise, keep going...
63 if (result
== -1 || rd
.error_detected (leader_follower
))
68 // Return an error if there was a problem receiving the reply.
69 if (max_wait_time
!= nullptr)
71 if (rd
.successful (leader_follower
) && *max_wait_time
== ACE_Time_Value::zero
)
81 if (rd
.error_detected (leader_follower
))
90 // Register the handler with the Reactor.
92 TAO_Wait_On_Reactor::register_handler ()
94 if (!this->is_registered_
)
96 return this->transport_
->register_handler ();
103 TAO_Wait_On_Reactor::non_blocking () const
109 TAO_Wait_On_Reactor::can_process_upcalls () const
114 TAO_END_VERSIONED_NAMESPACE_DECL