contrib: bump opendht to 1.5.0

* fix reported address issue
* fix SockAddr endianness issue
* fix memory leak
* minor performance improvements
* InfoHash: add operator bool()

Change-Id: I47ca3dedc1b96aa8082183eaf23fb9efc092b97a
This commit is contained in:
Adrien Béraud
2017-11-17 18:56:24 +01:00
parent 950ce8f142
commit e18892fbd9
5 changed files with 13 additions and 12 deletions

View File

@ -1 +1 @@
af2a3be1305a47043b932339545da7c947266e3120b6bedea3d5c837c5a6d4eb55d85a3008ba0ca7e90501a2c4ca9bc84c3c3d7fb1b0f8e2a6bcd0d5fe1ba3dd opendht-fcaaa01b2d40011df650cd092cb841e825c4e49c.tar.gz
eb2ffc2662cd981a552ae19109260a2d675de748906f5e1037b85fe123cfbd2b4a714ef1428444f69828d5cd2405f7cb70cd53ad36c71b298d9930c49fca16ba opendht-1.5.0.tar.gz

View File

@ -1,6 +1,6 @@
set BUILD=%SRC%..\build
set OPENDHT_VERSION=fcaaa01b2d40011df650cd092cb841e825c4e49c
set OPENDHT_VERSION=1.5.0
set OPENDHT_URL=https://github.com/savoirfairelinux/opendht/archive/%OPENDHT_VERSION%.tar.gz
mkdir %BUILD%
@ -19,4 +19,4 @@ cd %BUILD%\opendht
git apply --reject --whitespace=fix %SRC%\opendht\opendht-uwp.patch
cd %SRC%
cd %SRC%

View File

@ -1,5 +1,5 @@
# OPENDHT
OPENDHT_VERSION := fcaaa01b2d40011df650cd092cb841e825c4e49c
OPENDHT_VERSION := 1.5.0
OPENDHT_URL := https://github.com/savoirfairelinux/opendht/archive/$(OPENDHT_VERSION).tar.gz
PKGS += opendht

View File

@ -1848,32 +1848,33 @@ RingAccount::doRegister()
}
std::vector<std::pair<sockaddr_storage, socklen_t>>
std::vector<dht::SockAddr>
RingAccount::loadBootstrap() const
{
std::vector<std::pair<sockaddr_storage, socklen_t>> bootstrap;
std::vector<dht::SockAddr> bootstrap;
if (!hostname_.empty()) {
std::stringstream ss(hostname_);
std::string node_addr;
while (std::getline(ss, node_addr, ';')) {
auto ips = ip_utils::getAddrList(node_addr);
auto ips = dht::SockAddr::resolve(node_addr);
if (ips.empty()) {
IpAddr resolved(node_addr);
if (resolved) {
if (resolved.getPort() == 0)
resolved.setPort(DHT_DEFAULT_PORT);
bootstrap.emplace_back(resolved, resolved.getLength());
bootstrap.emplace_back(static_cast<const sockaddr*>(resolved), resolved.getLength());
}
} else {
bootstrap.reserve(bootstrap.size() + ips.size());
for (auto& ip : ips) {
if (ip.getPort() == 0)
ip.setPort(DHT_DEFAULT_PORT);
bootstrap.emplace_back(ip, ip.getLength());
bootstrap.emplace_back(std::move(ip));
}
}
}
for (auto ip : bootstrap)
RING_DBG("Bootstrap node: %s", IpAddr(ip.first).toString(true).c_str());
for (const auto& ip : bootstrap)
RING_DBG("Bootstrap node: %s", ip.toString().c_str());
}
return bootstrap;
}

View File

@ -505,7 +505,7 @@ class RingAccount : public SIPAccountBase {
void updateArchive(AccountArchive& content) const;
void saveArchive(AccountArchive& content, const std::string& pwd);
AccountArchive readArchive(const std::string& pwd) const;
std::vector<std::pair<sockaddr_storage, socklen_t>> loadBootstrap() const;
std::vector<dht::SockAddr> loadBootstrap() const;
static std::pair<std::string, std::string> saveIdentity(const dht::crypto::Identity id, const std::string& path, const std::string& name);
void saveNodes(const std::vector<dht::NodeExport>&) const;