upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorbitflash-maintainer <noreply@bitflash.invalid>2026-09-03 22:33:20 +0000
committerbitflash-maintainer <noreply@bitflash.invalid>2026-09-03 22:33:20 +0000
commitb810d86752ddb2674118f737582c924bb9eb74c1 (patch)
tree1ceadf421609a2e58da81103165a2fb7085387de /src/net.h
parentdb44eac5d347c229539946e8d61f1ff0d1f68001 (diff)
parent5ef59833756da6f47274cb990eb874fb0ed99019 (diff)
merge: upstream 1.2.20 into deploy/all-2026-08-24
# Conflicts: # Makefile
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/net.h b/src/net.h
index fc48d0b..752b1fe 100644
--- a/src/net.h
+++ b/src/net.h
@@ -124,6 +124,23 @@ static const unsigned int MAX_PROTOCOL_MESSAGE_SIZE = MAX_SIZE;
124// 125 is Bitcoin's number and remains a conservative public-node default. 124// 125 is Bitcoin's number and remains a conservative public-node default.
125static const unsigned int MAX_CONNECTIONS = 125; 125static const unsigned int MAX_CONNECTIONS = 125;
126 126
127// Cap inbound connections from any single address. Without it one source can
128// hold every slot up to MAX_CONNECTIONS -- exactly what happened to the
129// rendezvous relays, where a single IP parked hundreds of connections and
130// starved real peers. A legitimate peer, even a relay talking to a relay,
131// needs only a handful; 32 leaves generous room while denying any one address
132// more than a quarter of the table. The firewall connlimit on the relays does
133// the same thing a layer lower; this makes every build carry the defense.
134//
135// Loopback (127.0.0.0/8) is exempt in the accept path. A managed-Tor node
136// receives every inbound onion peer over its local hidden-service listener, so
137// they all appear as 127.0.0.1 -- capping loopback would cap onion peers as a
138// group, which is exactly wrong for a network moving toward onion-only. The
139// global MAX_CONNECTIONS still bounds the total; a per-onion-identity limit,
140// applied once identity is known after accept(), is the right future tool for
141// onion floods.
142static const unsigned int MAX_CONNECTIONS_PER_IP = 32;
143
127// A node marked for disconnect is normally held until its buffers drain, so 144// A node marked for disconnect is normally held until its buffers drain, so
128// a last message still goes out. But vSend cannot drain through a socket 145// a last message still goes out. But vSend cannot drain through a socket
129// whose far end is gone, and that made such a node immortal: it stayed in 146// whose far end is gone, and that made such a node immortal: it stayed in