diff options
Diffstat (limited to 'src/net.h')
| -rw-r--r-- | src/net.h | 15 |
1 files changed, 6 insertions, 9 deletions
| @@ -95,19 +95,16 @@ static const unsigned int MAX_PROTOCOL_MESSAGE_SIZE = MAX_SIZE; | |||
| 95 | 95 | ||
| 96 | // Ceiling on simultaneous connections. | 96 | // Ceiling on simultaneous connections. |
| 97 | // | 97 | // |
| 98 | // ThreadSocketHandler watches every peer through one select(), and select() | 98 | // ThreadSocketHandler watches every peer in one socket loop. This used to be a |
| 99 | // cannot watch more descriptors than FD_SETSIZE. On Windows FD_SET simply | 99 | // select() loop, which made FD_SETSIZE the real limit and silently starved |
| 100 | // stops adding once the set is full -- no error, no log -- so every socket | 100 | // sockets past that bitmap. It is now poll()/WSAPoll(), so the ceiling below is |
| 101 | // past the limit stays open and is never read again. Nothing capped vNodes, | 101 | // a deliberate resource bound rather than a descriptor-set accident. |
| 102 | // so a node accepted connections it had no way to service, and because new | ||
| 103 | // entries go on the end of vNodes it was always the newest connection that | ||
| 104 | // starved, including the ones dialed to fix connectivity. | ||
| 105 | // | 102 | // |
| 106 | // Measured on two nodes before this ceiling existed: 277 and 90 CNode objects | 103 | // Measured on two nodes before this ceiling existed: 277 and 90 CNode objects |
| 107 | // against 93 and 90 live sockets, and a status bar reporting hundreds of | 104 | // against 93 and 90 live sockets, and a status bar reporting hundreds of |
| 108 | // peers for a node that was really talking to thirty. | 105 | // peers for a node that was really talking to thirty. |
| 109 | // | 106 | // |
| 110 | // 125 is Bitcoin's number and sits far below FD_SETSIZE on both platforms. | 107 | // 125 is Bitcoin's number and remains a conservative public-node default. |
| 111 | static const unsigned int MAX_CONNECTIONS = 125; | 108 | static const unsigned int MAX_CONNECTIONS = 125; |
| 112 | 109 | ||
| 113 | // A node marked for disconnect is normally held until its buffers drain, so | 110 | // A node marked for disconnect is normally held until its buffers drain, so |
| @@ -175,7 +172,7 @@ static const int BTF_BEHIND_WARN_INTERVAL_SECS = 5 * 60; | |||
| 175 | // | 172 | // |
| 176 | // These counters exist so it can. Cheap to keep, and they name the failures | 173 | // These counters exist so it can. Cheap to keep, and they name the failures |
| 177 | // that actually happened rather than the ones that sound impressive. | 174 | // that actually happened rather than the ones that sound impressive. |
| 178 | extern int nPeersWatched; // peers in the last select() set | 175 | extern int nPeersWatched; // peers in the last poll() set |
| 179 | extern int64 nBlocksReceived; // blocks handed to ProcessBlock | 176 | extern int64 nBlocksReceived; // blocks handed to ProcessBlock |
| 180 | extern int64 nBlocksWithoutParent; // ...of those, how many arrived orphaned | 177 | extern int64 nBlocksWithoutParent; // ...of those, how many arrived orphaned |
| 181 | 178 | ||