diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-09-09 01:07:26 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-09-09 01:07:26 +0000 |
commit | 4f2c56cec3bf861f2d47489bd952afc50d2fc27a (patch) | |
tree | 5fa0268c8216c555da86c4cb60f7cfa4035e281a /TAO/tests/Bug_1270_Regression/Server_Timer.cpp | |
parent | 9aea408730cf5a04579f9ebe8f798632df025257 (diff) | |
download | ATCD-4f2c56cec3bf861f2d47489bd952afc50d2fc27a.tar.gz |
Sun Sep 8 21:04:45 2002 Carlos O'Ryan <coryan@atdesk.com>
Diffstat (limited to 'TAO/tests/Bug_1270_Regression/Server_Timer.cpp')
-rw-r--r-- | TAO/tests/Bug_1270_Regression/Server_Timer.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/TAO/tests/Bug_1270_Regression/Server_Timer.cpp b/TAO/tests/Bug_1270_Regression/Server_Timer.cpp new file mode 100644 index 00000000000..9c1ed051199 --- /dev/null +++ b/TAO/tests/Bug_1270_Regression/Server_Timer.cpp @@ -0,0 +1,67 @@ +/** + * @file + * + * $Id$ + * + * @author Carlos O'Ryan <coryan@atdesk.com> + * + */ +#include "Server_Timer.h" +#include "ace/Reactor.h" + +ACE_RCSID(Bug_1270_Regression, Server_Timer, "$Id$") + +Server_Timer::Server_Timer(Test::Echo_ptr echo, + ACE_Reactor * reactor) + : ACE_Event_Handler (reactor) + , echo_(Test::Echo::_duplicate(echo)) + , refcnt_ (1) +{ +} + +void +Server_Timer::activate (void) +{ + ACE_Time_Value tv (0, 20000); + this->reactor()->schedule_timer (this, 0, tv, tv); +} + +int +Server_Timer::handle_timeout (ACE_Time_Value const &, void const *) +{ + refcnt_++; + + ACE_DECLARE_NEW_CORBA_ENV; + + Test::Payload pload(1024); pload.length(1024); + ACE_OS::memset(pload.get_buffer(), pload.length(), 0); + ACE_TRY + { + Test::Echo_var echo = Test::Echo::_duplicate(this->echo_.in()); + if(CORBA::is_nil(echo.in())) + return 0; + + echo->echo_payload(pload); + } + ACE_CATCHANY + { + this->echo_ = Test::Echo::_nil (); + + if(this->reactor()->cancel_timer(this) != 0) + refcnt_--; + } + ACE_ENDTRY; + + refcnt_--; + if(refcnt_ == 0) + return -1; + + return 0; +} + +int +Server_Timer::handle_close (ACE_HANDLE, ACE_Reactor_Mask) +{ + delete this; + return 0; +} |