Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / Bug_1270_Regression / Server_Timer.cpp
blob4a727bce0fd5b7c9d45f34500ca3d1bc46dc9c2e
1 /**
2 * @file Server_Timer.cpp
4 * @author Carlos O'Ryan <coryan@atdesk.com>
5 */
6 #include "Server_Timer.h"
7 #include "ace/Reactor.h"
8 #include "ace/OS_NS_string.h"
10 Server_Timer::Server_Timer(Test::Echo_ptr echo,
11 ACE_Reactor * reactor)
12 : ACE_Event_Handler (reactor)
13 , echo_(Test::Echo::_duplicate(echo))
15 this->reference_counting_policy ().value (
16 ACE_Event_Handler::Reference_Counting_Policy::ENABLED);
19 void
20 Server_Timer::activate ()
22 ACE_Time_Value tv (0, 20000);
23 this->reactor()->schedule_timer (this, 0, tv, tv);
26 int
27 Server_Timer::handle_timeout (ACE_Time_Value const &, void const *)
29 Test::Payload pload (1024);
30 pload.length (1024);
32 ACE_OS::memset (pload.get_buffer(), 0, pload.length());
34 try
36 if(CORBA::is_nil (this->echo_.in ()))
37 return -1;
39 Test::Echo_var echo =
40 Test::Echo::_duplicate (this->echo_.in ());
42 echo->echo_payload (pload);
44 catch (const CORBA::Exception&)
46 this->echo_ = Test::Echo::_nil ();
47 this->reactor ()->cancel_timer (this);
48 return -1;
51 return 0;