diff --git a/daemon/contrib/src/opendht/rules.mak b/daemon/contrib/src/opendht/rules.mak index 7a7ad8533ca8cd6031fc284ec97f8b06e3a7f41a..9c48f53a1cc221557fad2af8a3fd90bbe08fb5d9 100644 --- a/daemon/contrib/src/opendht/rules.mak +++ b/daemon/contrib/src/opendht/rules.mak @@ -1,5 +1,5 @@ # OPENDHT -OPENDHT_VERSION := 955b68a4398f10b5e4104066557ff491051bdf7c +OPENDHT_VERSION := 441cad2e86c17eb5ebbada74518d479f52f63902 OPENDHT_URL := https://github.com/savoirfairelinux/opendht/archive/$(OPENDHT_VERSION).tar.gz PKGS += opendht diff --git a/daemon/src/ringdht/ringaccount.cpp b/daemon/src/ringdht/ringaccount.cpp index d0cc0e5e1c16870dd10d8f4a7b24e0b4bad78457..9ad2194754618cbc0d371f4eb6276f39dae7927f 100644 --- a/daemon/src/ringdht/ringaccount.cpp +++ b/daemon/src/ringdht/ringaccount.cpp @@ -729,7 +729,7 @@ void RingAccount::doRegister_() dht_.bootstrap(loadNodes()); if (!hostname_.empty()) { std::stringstream ss(hostname_); - std::vector<sockaddr_storage> bootstrap; + std::vector<std::pair<sockaddr_storage, socklen_t>> bootstrap; std::string node_addr; while (std::getline(ss, node_addr, ';')) { auto ips = ip_utils::getAddrList(node_addr); @@ -738,17 +738,18 @@ void RingAccount::doRegister_() if (resolved) { if (resolved.getPort() == 0) resolved.setPort(DHT_DEFAULT_PORT); - bootstrap.push_back(resolved); + bootstrap.emplace_back(resolved, resolved.getLength()); } } else { - for (auto& ip : ips) + for (auto& ip : ips) { if (ip.getPort() == 0) ip.setPort(DHT_DEFAULT_PORT); - bootstrap.insert(bootstrap.end(), ips.begin(), ips.end()); + bootstrap.emplace_back(ip, ip.getLength()); + } } } 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); }