OpenDDS::DCPS::SynWatchdog Class Reference

#include <MulticastSession.h>

Inheritance diagram for OpenDDS::DCPS::SynWatchdog:

Inheritance graph
[legend]
Collaboration diagram for OpenDDS::DCPS::SynWatchdog:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SynWatchdog (ACE_Reactor *reactor, ACE_thread_t owner, MulticastSession *session)
virtual bool reactor_is_shut_down () const

Protected Member Functions

virtual ACE_Time_Value next_interval ()
virtual void on_interval (const void *arg)
virtual ACE_Time_Value next_timeout ()
virtual void on_timeout (const void *arg)

Private Member Functions

 ~SynWatchdog ()

Private Attributes

MulticastSessionsession_
size_t retries_

Detailed Description

Definition at line 33 of file MulticastSession.h.


Constructor & Destructor Documentation

OpenDDS::DCPS::SynWatchdog::SynWatchdog ( ACE_Reactor *  reactor,
ACE_thread_t  owner,
MulticastSession session 
) [explicit]

Definition at line 19 of file MulticastSession.cpp.

00022   : DataLinkWatchdog (reactor, owner)
00023   , session_(session)
00024   , retries_(0)
00025 {
00026 }

OpenDDS::DCPS::SynWatchdog::~SynWatchdog (  )  [inline, private]

Definition at line 50 of file MulticastSession.h.

00050 { }


Member Function Documentation

ACE_Time_Value OpenDDS::DCPS::SynWatchdog::next_interval (  )  [protected, virtual]

Implements OpenDDS::DCPS::DataLinkWatchdog.

Definition at line 35 of file MulticastSession.cpp.

References OpenDDS::DCPS::MulticastDataLink::config(), OpenDDS::DCPS::MulticastSession::link(), retries_, session_, OpenDDS::DCPS::MulticastInst::syn_backoff_, and OpenDDS::DCPS::MulticastInst::syn_interval_.

00036 {
00037   MulticastInst* config = this->session_->link()->config();
00038   ACE_Time_Value interval(config->syn_interval_);
00039 
00040   // Apply exponential backoff based on number of retries:
00041   if (this->retries_ > 0) {
00042     interval *= std::pow(config->syn_backoff_, double(this->retries_));
00043   }
00044   ++this->retries_;
00045 
00046   return interval;
00047 }

ACE_Time_Value OpenDDS::DCPS::SynWatchdog::next_timeout (  )  [protected, virtual]

Reimplemented from OpenDDS::DCPS::DataLinkWatchdog.

Definition at line 58 of file MulticastSession.cpp.

References OpenDDS::DCPS::MulticastDataLink::config(), OpenDDS::DCPS::MulticastSession::link(), session_, and OpenDDS::DCPS::MulticastInst::syn_timeout_.

00059 {
00060   MulticastInst* config = this->session_->link()->config();
00061   return config->syn_timeout_;
00062 }

void OpenDDS::DCPS::SynWatchdog::on_interval ( const void *  arg  )  [protected, virtual]

Implements OpenDDS::DCPS::DataLinkWatchdog.

Definition at line 50 of file MulticastSession.cpp.

References OpenDDS::DCPS::MulticastSession::send_syn(), and session_.

00051 {
00052   // Initiate handshake by sending a MULTICAST_SYN control
00053   // sample to the assigned remote peer:
00054   this->session_->send_syn();
00055 }

void OpenDDS::DCPS::SynWatchdog::on_timeout ( const void *  arg  )  [protected, virtual]

Reimplemented from OpenDDS::DCPS::DataLinkWatchdog.

Definition at line 65 of file MulticastSession.cpp.

References OpenDDS::DCPS::MulticastSession::link(), OpenDDS::DCPS::MulticastDataLink::local_peer(), OpenDDS::DCPS::MulticastSession::remote_peer(), and session_.

00066 {
00067   // There is no recourse if a link is unable to handshake;
00068   // log an error and return:
00069   ACE_ERROR((LM_WARNING,
00070              ACE_TEXT("(%P|%t) WARNING: ")
00071              ACE_TEXT("SynWatchdog[transport=%C]::on_timeout: ")
00072              ACE_TEXT("timed out waiting on remote peer: %#08x%08x local: %#08x%08x\n"),
00073              this->session_->link()->config()->name().c_str(),
00074              (unsigned int)(this->session_->remote_peer() >> 32),
00075              (unsigned int) this->session_->remote_peer(),
00076              (unsigned int)(this->session_->link()->local_peer() >> 32),
00077              (unsigned int) this->session_->link()->local_peer()));
00078 }

bool OpenDDS::DCPS::SynWatchdog::reactor_is_shut_down (  )  const [virtual]

Implements OpenDDS::DCPS::ReactorInterceptor.

Definition at line 29 of file MulticastSession.cpp.

References OpenDDS::DCPS::TransportImpl::is_shut_down(), OpenDDS::DCPS::MulticastSession::link(), session_, and OpenDDS::DCPS::MulticastDataLink::transport().

00030 {
00031   return session_->link()->transport()->is_shut_down();
00032 }


Member Data Documentation

size_t OpenDDS::DCPS::SynWatchdog::retries_ [private]

Definition at line 52 of file MulticastSession.h.

Referenced by next_interval().

MulticastSession* OpenDDS::DCPS::SynWatchdog::session_ [private]

Definition at line 51 of file MulticastSession.h.

Referenced by next_interval(), next_timeout(), on_interval(), on_timeout(), and reactor_is_shut_down().


The documentation for this class was generated from the following files:
Generated on Fri Feb 12 20:06:34 2016 for OpenDDS by  doxygen 1.4.7