Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / Reactive_Connect_Strategy.cpp
blob8593179a35a6f16dcf926b4d4e956c513a648c04
1 // -*- C++ -*-
2 #include "tao/Reactive_Connect_Strategy.h"
3 #include "tao/Connection_Handler.h"
4 #include "tao/ORB_Core.h"
5 #include "tao/debug.h"
6 #include "tao/Transport.h"
7 #include "tao/LF_Multi_Event.h"
9 #include "ace/Synch_Options.h"
11 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
13 TAO_Reactive_Connect_Strategy::TAO_Reactive_Connect_Strategy (
14 TAO_ORB_Core *orb_core)
15 : TAO_Connect_Strategy (orb_core)
19 TAO_Reactive_Connect_Strategy::~TAO_Reactive_Connect_Strategy ()
23 void
24 TAO_Reactive_Connect_Strategy::synch_options (ACE_Time_Value *timeout,
25 ACE_Synch_Options &options)
27 if (timeout != nullptr)
29 options.set (ACE_Synch_Options::USE_REACTOR,
30 *timeout);
32 else
34 // Making it sure it is blocking.
35 options.set (ACE_Synch_Options::USE_REACTOR,
36 ACE_Time_Value::zero);
40 int
41 TAO_Reactive_Connect_Strategy::wait_i (TAO_LF_Event *ev,
42 TAO_Transport *,
43 ACE_Time_Value * max_wait_time)
45 int result = 0;
46 if (ev == nullptr)
47 return -1;
49 if (TAO_debug_level > 2)
51 //FUZZ: disable check_for_lack_ACE_OS
52 TAOLIB_DEBUG ((LM_DEBUG,
53 ACE_TEXT ("TAO (%P|%t) - Waiting in the Reactor for ")
54 ACE_TEXT ("connection completion - wait ()\n")));
55 //FUZZ: enable check_for_lack_ACE_OS
58 TAO_Leader_Follower &leader_follower = this->orb_core_->leader_follower ();
60 try
62 while (ev->keep_waiting (leader_follower))
64 result =
65 this->orb_core_->run (max_wait_time, 1);
67 // Did we timeout? If so, stop running the loop.
68 if (result == 0 &&
69 max_wait_time != nullptr &&
70 *max_wait_time == ACE_Time_Value::zero)
72 errno = ETIME;
73 result = -1;
74 break;
77 // Other errors? If so, stop running the loop.
78 if (result == -1)
79 break;
82 catch (const ::CORBA::Exception&)
84 result = -1;
87 // Set the result.
88 if (result != -1 && ev->error_detected (leader_follower))
90 result = -1;
93 return result;
96 TAO_END_VERSIONED_NAMESPACE_DECL