From f4e7cf7042dd2a54250baa7f979d41cccb56e78c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Wed, 18 Mar 2015 15:30:08 -0400 Subject: [PATCH] ringdht: fix bootstrap on OSX Refs #68794 Change-Id: Id2a087fb09d921c68f378b13f15fbaf0cf1a43ff --- daemon/contrib/src/opendht/rules.mak | 2 +- daemon/src/ringdht/ringaccount.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/daemon/contrib/src/opendht/rules.mak b/daemon/contrib/src/opendht/rules.mak index 7a7ad8533c..9c48f53a1c 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 d0cc0e5e1c..9ad2194754 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); } -- GitLab