summaryrefslogtreecommitdiff
path: root/node/Node.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2017-04-14 17:53:32 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2017-04-14 17:53:32 -0700
commit139c4b56337c0cfe7458ecf5df4e12e38c2d4f8a (patch)
treefa374c70645e5aade9d255d3f9bb3ab978bbe958 /node/Node.cpp
parent645bf4a764e6240bb7f36683aa739505f40b9cce (diff)
downloadinfinitytier-139c4b56337c0cfe7458ecf5df4e12e38c2d4f8a.tar.gz
infinitytier-139c4b56337c0cfe7458ecf5df4e12e38c2d4f8a.zip
Significant simplification to path logic.
Diffstat (limited to 'node/Node.cpp')
-rw-r--r--node/Node.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/node/Node.cpp b/node/Node.cpp
index 9844b09e..1bc96cca 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -407,17 +407,17 @@ ZT_PeerList *Node::peers() const
p->latency = pi->second->latency();
p->role = RR->topology->role(pi->second->identity().address());
- std::vector< std::pair< SharedPtr<Path>,bool > > paths(pi->second->paths(_now));
+ std::vector< SharedPtr<Path> > paths(pi->second->paths(_now));
SharedPtr<Path> bestp(pi->second->getBestPath(_now,false));
p->pathCount = 0;
- for(std::vector< std::pair< SharedPtr<Path>,bool > >::iterator path(paths.begin());path!=paths.end();++path) {
- memcpy(&(p->paths[p->pathCount].address),&(path->first->address()),sizeof(struct sockaddr_storage));
- p->paths[p->pathCount].lastSend = path->first->lastOut();
- p->paths[p->pathCount].lastReceive = path->first->lastIn();
- p->paths[p->pathCount].trustedPathId = RR->topology->getOutboundPathTrust(path->first->address());
- p->paths[p->pathCount].linkQuality = (int)path->first->linkQuality();
- p->paths[p->pathCount].expired = path->second;
- p->paths[p->pathCount].preferred = (path->first == bestp) ? 1 : 0;
+ for(std::vector< SharedPtr<Path> >::iterator path(paths.begin());path!=paths.end();++path) {
+ memcpy(&(p->paths[p->pathCount].address),&((*path)->address()),sizeof(struct sockaddr_storage));
+ p->paths[p->pathCount].lastSend = (*path)->lastOut();
+ p->paths[p->pathCount].lastReceive = (*path)->lastIn();
+ p->paths[p->pathCount].trustedPathId = RR->topology->getOutboundPathTrust((*path)->address());
+ p->paths[p->pathCount].linkQuality = (int)(*path)->linkQuality();
+ p->paths[p->pathCount].expired = 0;
+ p->paths[p->pathCount].preferred = ((*path) == bestp) ? 1 : 0;
++p->pathCount;
}
}