diff options
Diffstat (limited to 'src/net.h')
| -rw-r--r-- | src/net.h | 9 |
1 files changed, 9 insertions, 0 deletions
| @@ -112,6 +112,15 @@ static const int BTF_INCOMPLETE_MESSAGE_TIMEOUT_SECS = 2 * 60; | |||
| 112 | // 125 is Bitcoin's number and remains a conservative public-node default. | 112 | // 125 is Bitcoin's number and remains a conservative public-node default. |
| 113 | static const unsigned int MAX_CONNECTIONS = 125; | 113 | static const unsigned int MAX_CONNECTIONS = 125; |
| 114 | 114 | ||
| 115 | // Cap inbound connections from any single address. Without it one source can | ||
| 116 | // hold every slot up to MAX_CONNECTIONS -- exactly what happened to the | ||
| 117 | // rendezvous relays, where a single IP parked hundreds of connections and | ||
| 118 | // starved real peers. A legitimate peer, even a relay talking to a relay, | ||
| 119 | // needs only a handful; 32 leaves generous room while denying any one address | ||
| 120 | // more than a quarter of the table. The firewall connlimit on the relays does | ||
| 121 | // the same thing a layer lower; this makes every build carry the defense. | ||
| 122 | static const unsigned int MAX_CONNECTIONS_PER_IP = 32; | ||
| 123 | |||
| 115 | // A node marked for disconnect is normally held until its buffers drain, so | 124 | // A node marked for disconnect is normally held until its buffers drain, so |
| 116 | // a last message still goes out. But vSend cannot drain through a socket | 125 | // a last message still goes out. But vSend cannot drain through a socket |
| 117 | // whose far end is gone, and that made such a node immortal: it stayed in | 126 | // whose far end is gone, and that made such a node immortal: it stayed in |