Fix trunk reconnect storm with per-IP pending connection limit

When two trunk peers simultaneously reconnect, rapid retries from one
peer could fill the global pending connection pool (5 slots), starving
other peers and creating a reject→reconnect→reject loop.

Add a per-IP limit of 2 pending (pre-hello) connections in the trunk
server, so one misbehaving or rapidly-reconnecting peer cannot exhaust
the pool.  Also increase outbound reconnect backoff (2s min, 30s max)
to reduce retry pressure after connection failures.
This commit is contained in:
Audric committed 2026-03-29 19:47:17 +02:00
1 parent 4e6bff7962
commit 7d1aeff623
2 files changed
+26 -3

No files matched your search

+2
View File
@@ -189,6 +189,8 @@ bool TrunkLink::initialize(void)
<< " remote_prefix=" << joinPrefixes(m_remote_prefix) << endl;
m_con.addStaticSRVRecord(0, 0, 0, m_peer_port, m_peer_host);
m_con.setReconnectMinTime(2000);
m_con.setReconnectMaxTime(30000);
m_con.connect();
return true;