Browse Source

Don't burn through a client's HSDirs too fast in hs-min

teor (Tim Wilson-Brown) 7 years ago
parent
commit
aad22037a2
2 changed files with 7 additions and 4 deletions
  1. 4 3
      lib/chutney/Traffic.py
  2. 3 1
      networks/hs-min

+ 4 - 3
lib/chutney/Traffic.py

@@ -291,11 +291,12 @@ class Source(Peer):
         else:
             debug("BUG: sent no bytes")
             self._sent_no_bytes += 1
-            if self._sent_no_bytes >= 10:
+            # We can't retry too fast, otherwise clients burn all their HSDirs
+            if self._sent_no_bytes >= 3:
                 print("Send no data %d times. Stalled." %
                       (self._sent_no_bytes))
-                sys.exit(-1)
-            time.sleep(1)
+                return -1
+            time.sleep(3)
         self.outbuf = self.outbuf[n:]
         if self.state == self.CONNECTING_THROUGH_PROXY:
             return 1  # Keep us around.

+ 3 - 1
networks/hs-min

@@ -11,7 +11,9 @@ HS = Node(tag="h", hs=1, torrc="hs.tmpl")
 # connections:
 # a minimum path length of 3, plus the client-nominated rendezvous point,
 # plus a seperate introduction point
-NODES = Authority.getN(3) + NonExitRelay.getN(2) + \
+# But we use 6 HSDirs: when the hidden service is not up, the client fails to
+# find the descriptor at the first 3-5 HSDirs
+NODES = Authority.getN(3) + NonExitRelay.getN(3) + \
         Client.getN(1) + HS.getN(1)
 
 ConfigureNodes(NODES)