Public Member Functions
LinkTimer Class Reference

Brief description of class still missing. More...

#include <LinkTimer.h>

Inheritance diagram for LinkTimer:
GpCoreTools::Timer

List of all members.

Public Member Functions

virtual bool exec ()
 LinkTimer (const Address &peer, uint16_t port)

Detailed Description

Brief description of class still missing.

Full description of class still missing


Constructor & Destructor Documentation

LinkTimer::LinkTimer ( const Address peer,
uint16_t  port 
)

References GpCoreTools::Timer::setInterval().

{
  _peer=peer;
  _port=port;
  _tryCount=0;
  setInterval(10000);
}

Member Function Documentation

bool LinkTimer::exec ( ) [virtual]

Performs action after timeout. If it returns true the timer is not single shot, i.e. deleted right after exec().

Implements GpCoreTools::Timer.

References LinkStream::connect(), PeerTracker::instance(), and PeerTracker::stop().

Referenced by PeerInfo::connect().

{
  _tryCount++;
  LinkStream * l=new LinkStream(_peer);
  if(l->connect(_port)) {
    EventLoop::instance()->addStream(l);
    return false;
  } else {
    delete l;
    if(_tryCount>=5) {
      PeerTracker::instance()->stop(_peer);
      return false;
    } else {
      return true;
    }
  }
}

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines