Skip to content
Snippets Groups Projects
Commit f4e7cf70 authored by Adrien Béraud's avatar Adrien Béraud Committed by Alexandre Lision
Browse files

ringdht: fix bootstrap on OSX

Refs #68794

Change-Id: Id2a087fb09d921c68f378b13f15fbaf0cf1a43ff
parent 7ed42d54
No related branches found
No related tags found
No related merge requests found
# OPENDHT # OPENDHT
OPENDHT_VERSION := 955b68a4398f10b5e4104066557ff491051bdf7c OPENDHT_VERSION := 441cad2e86c17eb5ebbada74518d479f52f63902
OPENDHT_URL := https://github.com/savoirfairelinux/opendht/archive/$(OPENDHT_VERSION).tar.gz OPENDHT_URL := https://github.com/savoirfairelinux/opendht/archive/$(OPENDHT_VERSION).tar.gz
PKGS += opendht PKGS += opendht
......
...@@ -729,7 +729,7 @@ void RingAccount::doRegister_() ...@@ -729,7 +729,7 @@ void RingAccount::doRegister_()
dht_.bootstrap(loadNodes()); dht_.bootstrap(loadNodes());
if (!hostname_.empty()) { if (!hostname_.empty()) {
std::stringstream ss(hostname_); std::stringstream ss(hostname_);
std::vector<sockaddr_storage> bootstrap; std::vector<std::pair<sockaddr_storage, socklen_t>> bootstrap;
std::string node_addr; std::string node_addr;
while (std::getline(ss, node_addr, ';')) { while (std::getline(ss, node_addr, ';')) {
auto ips = ip_utils::getAddrList(node_addr); auto ips = ip_utils::getAddrList(node_addr);
...@@ -738,17 +738,18 @@ void RingAccount::doRegister_() ...@@ -738,17 +738,18 @@ void RingAccount::doRegister_()
if (resolved) { if (resolved) {
if (resolved.getPort() == 0) if (resolved.getPort() == 0)
resolved.setPort(DHT_DEFAULT_PORT); resolved.setPort(DHT_DEFAULT_PORT);
bootstrap.push_back(resolved); bootstrap.emplace_back(resolved, resolved.getLength());
} }
} else { } else {
for (auto& ip : ips) for (auto& ip : ips) {
if (ip.getPort() == 0) if (ip.getPort() == 0)
ip.setPort(DHT_DEFAULT_PORT); ip.setPort(DHT_DEFAULT_PORT);
bootstrap.insert(bootstrap.end(), ips.begin(), ips.end()); bootstrap.emplace_back(ip, ip.getLength());
}
} }
} }
for (auto ip : bootstrap) for (auto ip : bootstrap)
RING_DBG("Bootstrap node: %s", IpAddr(ip).toString(true).c_str()); RING_DBG("Bootstrap node: %s", IpAddr(ip.first).toString(true).c_str());
dht_.bootstrap(bootstrap); dht_.bootstrap(bootstrap);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment