summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-04-06 11:50:00 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-04-06 11:50:00 -0700
commit8ef78e7e7db53c190071034cc4c8e1bbbe70c619 (patch)
treea9e0c72c4fa6fa628b0945354daa00c045245e75
parent504738b1839ca7f38ea4421dbe142a6192f6c2d4 (diff)
downloadinfinitytier-8ef78e7e7db53c190071034cc4c8e1bbbe70c619.tar.gz
infinitytier-8ef78e7e7db53c190071034cc4c8e1bbbe70c619.zip
Preserve add local interface address add order and send in that order since this is a priority.
-rw-r--r--node/Node.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/node/Node.cpp b/node/Node.cpp
index 2e208a42..1934ef7d 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -493,10 +493,10 @@ int Node::addLocalInterfaceAddress(const struct sockaddr_storage *addr)
{
if (Path::isAddressValidForPath(*(reinterpret_cast<const InetAddress *>(addr)))) {
Mutex::Lock _l(_directPaths_m);
- _directPaths.push_back(*(reinterpret_cast<const InetAddress *>(addr)));
- std::sort(_directPaths.begin(),_directPaths.end());
- _directPaths.erase(std::unique(_directPaths.begin(),_directPaths.end()),_directPaths.end());
- return 1;
+ if (std::find(_directPaths.begin(),_directPaths.end(),*(reinterpret_cast<const InetAddress *>(addr))) == _directPaths.end()) {
+ _directPaths.push_back(*(reinterpret_cast<const InetAddress *>(addr)));
+ return 1;
+ }
}
return 0;
}