Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / LF_Connect_Strategy.cpp
blobb59e184e042275d3313b55c454d6ffabe1680cd7
1 #include "tao/LF_Connect_Strategy.h"
2 #include "tao/Nested_Upcall_Guard.h"
3 #include "tao/LF_Multi_Event.h"
4 #include "tao/Connection_Handler.h"
5 #include "tao/LF_Follower.h"
6 #include "tao/Leader_Follower.h"
7 #include "tao/Transport.h"
8 #include "tao/ORB_Core.h"
9 #include "ace/Synch_Options.h"
11 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
13 TAO_LF_Connect_Strategy::TAO_LF_Connect_Strategy (TAO_ORB_Core *orb_core,
14 bool no_upcall)
15 : TAO_Connect_Strategy (orb_core),
16 no_upcall_ (no_upcall)
20 TAO_LF_Connect_Strategy::~TAO_LF_Connect_Strategy ()
24 void
25 TAO_LF_Connect_Strategy::synch_options (ACE_Time_Value *timeout,
26 ACE_Synch_Options &options)
28 if (timeout != nullptr)
30 options.set (ACE_Synch_Options::USE_REACTOR, *timeout);
32 else
34 // Making it sure it is blocking.
35 options.set (ACE_Synch_Options::USE_REACTOR, ACE_Time_Value::zero);
39 int
40 TAO_LF_Connect_Strategy::wait_i (TAO_LF_Event *ev,
41 TAO_Transport *transport,
42 ACE_Time_Value *max_wait_time)
44 if (transport == nullptr)
45 return -1;
47 TAO::Nested_Upcall_Guard guard(transport, this->no_upcall_);
49 TAO_Leader_Follower &leader_follower =
50 this->orb_core_->leader_follower ();
52 int result =
53 leader_follower.wait_for_event (ev, transport, max_wait_time);
55 if (ev->error_detected (leader_follower) && result != -1)
56 result = -1;
58 return result;
62 TAO_END_VERSIONED_NAMESPACE_DECL