diff options
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_SupplierControl.cpp')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_SupplierControl.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_SupplierControl.cpp b/TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_SupplierControl.cpp index f7387bfaf0f..8c7ca1f703a 100644 --- a/TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_SupplierControl.cpp +++ b/TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_SupplierControl.cpp @@ -29,6 +29,12 @@ TAO_CEC_Reactive_SupplierControl:: { this->reactor_ = this->orb_->orb_core ()->reactor (); + +#if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 + // Initialise timer_id_ to an invalid timer id, so that in case we don't + // schedule a timer, we don't cancel a random timer at shutdown + timer_id_ = -1; +#endif /* TAO_HAS_CORBA_MESSAGING */ } TAO_CEC_Reactive_SupplierControl::~TAO_CEC_Reactive_SupplierControl (void) @@ -96,13 +102,6 @@ int TAO_CEC_Reactive_SupplierControl::activate (void) { #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 - timer_id_ = this->reactor_->schedule_timer (&this->adapter_, - 0, - this->rate_, - this->rate_); - if (timer_id_ == -1) - return -1; - ACE_TRY_NEW_ENV { // Get the PolicyCurrent object @@ -118,7 +117,7 @@ TAO_CEC_Reactive_SupplierControl::activate (void) // Timeout for polling state (default = 10 msec) TimeBase::TimeT timeout = timeout_.usec() * 10; - CORBA::Any any; + CORBA::Any any; any <<= timeout; this->policy_list_.length (1); @@ -128,6 +127,20 @@ TAO_CEC_Reactive_SupplierControl::activate (void) any ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; + + // Only schedule the timer, when the rate is not zero + if (this->rate_ != ACE_Time_Value::zero) + { + // Schedule the timer after these policies has been set, because the + // handle_timeout uses these policies, if done in front, the channel + // can crash when the timeout expires before initiazation is ready. + timer_id_ = this->reactor_->schedule_timer (&this->adapter_, + 0, + this->rate_, + this->rate_); + if (timer_id_ == -1) + return -1; + } } ACE_CATCHANY { |