Brief description of class still missing. More...
#include <LinkTimer.h>
Public Member Functions | |
| virtual bool | exec () |
| LinkTimer (const Address &peer, uint16_t port) | |
Brief description of class still missing.
Full description of class still missing
| LinkTimer::LinkTimer | ( | const Address & | peer, |
| uint16_t | port | ||
| ) |
References GpCoreTools::Timer::setInterval().
{
_peer=peer;
_port=port;
_tryCount=0;
setInterval(10000);
}
| 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;
}
}
}