Brief description of class still missing. More...
#include <PeerInfo.h>
Public Member Functions | |
void | addDestination (const Address &destination) |
const Address & | address () const |
void | beaconReceived () |
void | calculate () |
void | connect (const Address &peer, uint16_t port) |
double | lastBeaconDelay () |
const LinkInfo & | link () const |
const MasterTime & | masterTime () const |
PeerInfo (const Address &a) | |
const MasterTime & | peerMasterTime () const |
void | setLink (const LinkInfo &l) |
void | setMasterTime (const MasterTime &m) |
void | setPeerMasterTime (const MasterTime &m) |
void | setStream (LinkStream *stream) |
const LinkStream * | stream () const |
~PeerInfo () |
Brief description of class still missing.
Full description of class still missing
PeerInfo::PeerInfo | ( | const Address & | a | ) |
Description of constructor still missing
{ _address=a; _timer=0; _stream=0; }
Description of destructor still missing
References GpCoreTools::Stream::close().
{ delete _timer; if(_stream) _stream->close(); }
void PeerInfo::addDestination | ( | const Address & | destination | ) |
const Address& PeerInfo::address | ( | ) | const [inline] |
Referenced by PeerTracker::checkDeadPeers(), PeerTracker::resetFromMasterGateway(), PeerTracker::resetToMasterGateway(), and PeerTracker::stop().
{return _address;}
void PeerInfo::beaconReceived | ( | ) | [inline] |
void PeerInfo::calculate | ( | ) |
Link and peer master time must be up-to-date.
References LinkInfo::isLinked(), LinkInfo::latency(), MasterTime::setTimeFromMaster(), MasterTime::setTimeToMaster(), LinkInfo::slownessFromPeer(), LinkInfo::slownessToPeer(), MasterTime::timeFromMaster(), and MasterTime::timeToMaster().
Referenced by PeerTracker::setLink().
{ if(_link.isLinked()) { if(_peerMasterTime.timeToMaster()<1e99) { _masterTime.setTimeToMaster(_peerMasterTime.timeToMaster()+_link.latency()+128*_link.slownessToPeer()); } if(_peerMasterTime.timeFromMaster()<1e99) { _masterTime.setTimeFromMaster(_peerMasterTime.timeFromMaster()+_link.latency()+128*_link.slownessFromPeer()); } } else { _masterTime.setTimeToMaster(1e99); _masterTime.setTimeFromMaster(1e99); } }
void PeerInfo::connect | ( | const Address & | peer, |
uint16_t | port | ||
) |
References LinkTimer::exec(), and GpCoreTools::Timer::start().
double PeerInfo::lastBeaconDelay | ( | ) | [inline] |
References GpCoreTools::Chrono::elapsed().
Referenced by PeerTracker::checkDeadPeers().
{return _lastBeacon.elapsed();}
const LinkInfo& PeerInfo::link | ( | ) | const [inline] |
{return _link;}
const MasterTime& PeerInfo::masterTime | ( | ) | const [inline] |
Referenced by PeerTracker::resetFromMasterGateway(), PeerTracker::resetToMasterGateway(), and PeerTracker::setLink().
{return _masterTime;}
const MasterTime& PeerInfo::peerMasterTime | ( | ) | const [inline] |
{return _peerMasterTime;}
void PeerInfo::setLink | ( | const LinkInfo & | l | ) | [inline] |
Referenced by PeerTracker::setLink().
{_link=l;}
void PeerInfo::setMasterTime | ( | const MasterTime & | m | ) | [inline] |
{_masterTime=m;}
void PeerInfo::setPeerMasterTime | ( | const MasterTime & | m | ) | [inline] |
Referenced by PeerTracker::setLink().
{_peerMasterTime=m;}
void PeerInfo::setStream | ( | LinkStream * | stream | ) |
const LinkStream* PeerInfo::stream | ( | ) | const [inline] |
Referenced by PeerTracker::addFromMasterRoute(), PeerTracker::removeFromMasterRoute(), and setStream().
{return _stream;}