diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-09-02 11:51:33 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-09-02 11:51:33 -0700 |
| commit | e8f6b4b5d33e7b762b952d599e8cc9e730b21c03 (patch) | |
| tree | d40cd4299375b038a53ccd6b284206a90dacb9bc /node/Node.cpp | |
| parent | a3bdae9735572fd6d888e6bf29b0302983a7c24c (diff) | |
| download | infinitytier-e8f6b4b5d33e7b762b952d599e8cc9e730b21c03.tar.gz infinitytier-e8f6b4b5d33e7b762b952d599e8cc9e730b21c03.zip | |
Rest of big Path canonicalization refactor.
Diffstat (limited to 'node/Node.cpp')
| -rw-r--r-- | node/Node.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/node/Node.cpp b/node/Node.cpp index ff564eee..39e24325 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -415,16 +415,16 @@ ZT_PeerList *Node::peers() const p->latency = pi->second->latency(); p->role = RR->topology->isRoot(pi->second->identity()) ? ZT_PEER_ROLE_ROOT : ZT_PEER_ROLE_LEAF; - std::vector<Path> paths(pi->second->paths()); - Path *bestPath = pi->second->getBestPath(_now); + std::vector< SharedPtr<Path> > paths(pi->second->paths()); + SharedPtr<Path> bestp(pi->second->getBestPath(_now,true)); p->pathCount = 0; - for(std::vector<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->lastSend(); - p->paths[p->pathCount].lastReceive = path->lastReceived(); - p->paths[p->pathCount].active = path->active(_now) ? 1 : 0; - p->paths[p->pathCount].preferred = ((bestPath)&&(*path == *bestPath)) ? 1 : 0; - p->paths[p->pathCount].trustedPathId = RR->topology->getOutboundPathTrust(path->address()); + 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].active = (*path)->alive(_now) ? 1 : 0; + p->paths[p->pathCount].preferred = (*path == bestp) ? 1 : 0; + p->paths[p->pathCount].trustedPathId = RR->topology->getOutboundPathTrust((*path)->address()); ++p->pathCount; } } |
