Compare commits

..

4 Commits

Author SHA1 Message Date
Niq Dudfield
f3c69ae34e Merge branch 'dev' into fix-ips-fixed 2025-11-27 19:46:22 +07:00
Niq Dudfield
f6a4e8f36d Wind back macOS runner version (#635) 2025-11-27 09:39:27 +10:00
tequ
70bbe83525 Revert "Update workers to self hosted" (#638) 2025-11-27 09:38:45 +10:00
Nicholas Dudfield
aee8087042 fix: restore [ips_fixed] to use addFixedPeer instead of addFallbackStrings
Commit c65a0332bc refactored IP handling but accidentally broke [ips_fixed]
by treating fixed peers as regular bootstrap sources. This caused fixed
peers to not bypass slot limits, breaking connectivity for nodes with low
peers_max values.

This fix does NOT restore:
- The fallback behavior where [ips_fixed] was used as bootstrap when [ips]
  was empty (added in 98bdb9de68, 2015)
- Any hardcoded default bootstrap IPs

These are unnecessary because addFixedPeer actively maintains connections
to fixed peers regardless of the bootstrap mechanism. Nodes with only
[ips_fixed] configured will still connect and discover peers through
their fixed connections.

Closes #636
2025-11-26 09:29:26 +07:00
2 changed files with 35 additions and 18 deletions

View File

@@ -20,7 +20,7 @@ jobs:
- Ninja - Ninja
configuration: configuration:
- Debug - Debug
runs-on: macos-15-xlarge runs-on: macos-15
env: env:
build_dir: .build build_dir: .build
# Bump this number to invalidate all caches globally. # Bump this number to invalidate all caches globally.

View File

@@ -484,44 +484,61 @@ OverlayImpl::start()
m_peerFinder->setConfig(config); m_peerFinder->setConfig(config);
m_peerFinder->start(); m_peerFinder->start();
auto addIps = [&](std::vector<std::string> bootstrapIps) -> void { auto addIps = [this](std::vector<std::string> ips, bool fixed) {
beast::Journal const& j = app_.journal("Overlay"); beast::Journal const& j = app_.journal("Overlay");
for (auto& ip : bootstrapIps) for (auto& ip : ips)
{ {
std::size_t pos = ip.find('#'); std::size_t pos = ip.find('#');
if (pos != std::string::npos) if (pos != std::string::npos)
ip.erase(pos); ip.erase(pos);
JLOG(j.trace()) << "Found boostrap IP: " << ip; JLOG(j.trace())
<< "Found " << (fixed ? "fixed" : "bootstrap") << " IP: " << ip;
} }
m_resolver.resolve( m_resolver.resolve(
bootstrapIps, ips,
[&](std::string const& name, [this, fixed](
std::string const& name,
std::vector<beast::IP::Endpoint> const& addresses) { std::vector<beast::IP::Endpoint> const& addresses) {
std::vector<std::string> ips;
ips.reserve(addresses.size());
beast::Journal const& j = app_.journal("Overlay"); beast::Journal const& j = app_.journal("Overlay");
std::string const base("config: ");
std::vector<beast::IP::Endpoint> eps;
eps.reserve(addresses.size());
for (auto const& addr : addresses) for (auto const& addr : addresses)
{ {
std::string addrStr = addr.port() == 0 auto ep = addr.port() == 0 ? addr.at_port(DEFAULT_PEER_PORT)
? to_string(addr.at_port(DEFAULT_PEER_PORT)) : addr;
: to_string(addr); JLOG(j.trace())
JLOG(j.trace()) << "Parsed boostrap IP: " << addrStr; << "Parsed " << (fixed ? "fixed" : "bootstrap")
ips.push_back(addrStr); << " IP: " << ep;
eps.push_back(ep);
} }
std::string const base("config: "); if (eps.empty())
if (!ips.empty()) return;
m_peerFinder->addFallbackStrings(base + name, ips);
if (fixed)
{
m_peerFinder->addFixedPeer(base + name, eps);
}
else
{
std::vector<std::string> strs;
strs.reserve(eps.size());
for (auto const& ep : eps)
strs.push_back(to_string(ep));
m_peerFinder->addFallbackStrings(base + name, strs);
}
}); });
}; };
if (!app_.config().IPS.empty()) if (!app_.config().IPS.empty())
addIps(app_.config().IPS); addIps(app_.config().IPS, false);
if (!app_.config().IPS_FIXED.empty()) if (!app_.config().IPS_FIXED.empty())
addIps(app_.config().IPS_FIXED); addIps(app_.config().IPS_FIXED, true);
auto const timer = std::make_shared<Timer>(*this); auto const timer = std::make_shared<Timer>(*this);
std::lock_guard lock(mutex_); std::lock_guard lock(mutex_);