diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/net.h | 26 |
1 files changed, 21 insertions, 5 deletions
| @@ -54,11 +54,27 @@ static const int64 PEX_MIN_INTERVAL = 60; | |||
| 54 | // traffic is nothing: one per relay per five minutes. | 54 | // traffic is nothing: one per relay per five minutes. |
| 55 | static const int BTF_RENDEZVOUS_WAIT_SECS = 300; | 55 | static const int BTF_RENDEZVOUS_WAIT_SECS = 300; |
| 56 | 56 | ||
| 57 | // Registrations this node parks at a rendezvous at once. One is what the | 57 | // Registrations this node parks at a rendezvous at once. |
| 58 | // protocol needs; more is what keeps the node reachable while one of them is | 58 | // |
| 59 | // being paired, since pairing consumes the registration it used. Four matches | 59 | // Back to one, and it stays at one until every relay in vBtfMeetingRelays runs |
| 60 | // the relay's ceiling per node. | 60 | // the queue from #113. More than one is what keeps a node reachable while one |
| 61 | static const int BTF_ACCEPT_THREADS = 3; | 61 | // registration is being paired -- but only against a relay that accepts more |
| 62 | // than one. An older relay closes the previous registration whenever the same | ||
| 63 | // node registers again, so several accept threads pointed at one of those | ||
| 64 | // evict each other in a loop: thread 2 registers and kills thread 1, thread 3 | ||
| 65 | // kills thread 2, thread 1 sees its socket die and kills thread 3. | ||
| 66 | // | ||
| 67 | // #113 called that harmless. It is not. Measured on a node running three | ||
| 68 | // threads against the un-upgraded New Jersey relay: 189 registrations in about | ||
| 69 | // fifteen minutes -- roughly twelve a minute -- and not one pairing. The node | ||
| 70 | // was not merely failing to benefit, it was unreachable through that relay and | ||
| 71 | // hammering it. A node with one thread does none of this. | ||
| 72 | // | ||
| 73 | // The bench that approved #113 could not see it: its harness re-registers by | ||
| 74 | // design, which is exactly what hides an eviction loop. | ||
| 75 | // | ||
| 76 | // Raise this to 3 only when the other two relays are upgraded. | ||
| 77 | static const int BTF_ACCEPT_THREADS = 1; | ||
| 62 | 78 | ||
| 63 | // Liveness of an established peer connection. BTF_RENDEZVOUS_WAIT_SECS bounds | 79 | // Liveness of an established peer connection. BTF_RENDEZVOUS_WAIT_SECS bounds |
| 64 | // the wait for a dial to arrive; these bound the connection that comes out of | 80 | // the wait for a dial to arrive; these bound the connection that comes out of |