From b1af22a15ec9369ed0543b101dd787b2c36d5c99 Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Mon, 5 May 2008 13:57:54 +0000 Subject: [PATCH] - Have SSU bid aggressively when it has less than 3 peers, so we can determine our IP address and do peer testing. Otherwise a router may never determine its IP address or reachability status. --- .../src/net/i2p/router/transport/udp/UDPTransport.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java index 1e7fed417a..967ce0458c 100644 --- a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java +++ b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java @@ -863,7 +863,14 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority if (_log.shouldLog(Log.DEBUG)) _log.debug("bidding on a message to an unestablished peer: " + to.toBase64()); - if (alwaysPreferUDP()) + + // Try to maintain at least 3 peers so we can determine our IP address and + // we have a selection to run peer tests with. + int count; + synchronized (_peersByIdent) { + count = _peersByIdent.size(); + } + if (alwaysPreferUDP() || count < 3) return _slowPreferredBid; else if (preferUDP()) return _slowBid; -- GitLab