Opened 10 months ago

Closed 9 months ago

#2441 closed defect (fixed)

Initial SSU Peer Test does not run

Reported by: Zlatin Balevsky Owned by: zzz
Priority: minor Milestone: 0.9.39
Component: router/transport Version: 0.9.38
Keywords: ssu Cc:
Parent Tickets: Sensitive: no

Description

In router/java/src/net/i2p/router/transport/udp/UDPTransport.java there is the following code:

_testEvent.setIsAlive(true); // this queues it for 3-6 minutes in the future...
_testEvent.reschedule(10*1000); // lets requeue it for Real Soon

However, when Real Soon arrives (10 * 1000ms) later no test for that specific protocol is performed. This is because when doing the initial binding to interfaces the time of the last test is set - consider the following stack trace:

17/02/19 15:58:32 DEBUG [JobQueue 1/1] er.transport.udp.PeerTestEvent: PTE.setLastTested() - v6? true
java.lang.Exception
        at net.i2p.router.transport.udp.PeerTestEvent.setLastTested(PeerTestEvent.java:138)
        at net.i2p.router.transport.udp.UDPTransport.locked_setReachabilityStatus(UDPTransport.java:2925)
        at net.i2p.router.transport.udp.UDPTransport.setReachabilityStatus(UDPTransport.java:2914)
        at net.i2p.router.transport.udp.UDPTransport.startup(UDPTransport.java:553)
        at net.i2p.router.transport.udp.UDPTransport.startListening(UDPTransport.java:2027)
        at net.i2p.router.transport.TransportManager.startListening(TransportManager.java:354)
        at net.i2p.router.transport.CommSystemFacadeImpl.startup(CommSystemFacadeImpl.java:63)

So when the PeerTestEvent kicks off 10 seconds later it finds out that 10*1000 < MIN_TEST_FREQUENCY (which is 45*1000) and does not test the protocol that was bound.

Note that if both IPv4 and IPv6 addresses are present, whatever the other protocol is will be tested.

Subtickets

Change History (3)

comment:1 Changed 10 months ago by zzz

Milestone: undecided0.9.39
Status: newaccepted

comment:2 Changed 10 months ago by zzz

how about something like this (untested) ?

#
# old_revision [d505721e58c3b7bbcdde170cecf9ed3f2e1843d3]
#
# patch "router/java/src/net/i2p/router/transport/udp/PeerTestEvent.java"
#  from [213e542e2b0d3bb0d4501e29cc62dd772054d01e]
#    to [bba9a58b0b6be38a0b4fa5fd3aa0efcd71dbd224]
# 
# patch "router/java/src/net/i2p/router/transport/udp/UDPTransport.java"
#  from [67540d7a57d681086701db0defcd869fce64192e]
#    to [39567600fb27d5fb61144480af6ea573bad4760d]
#
============================================================
--- router/java/src/net/i2p/router/transport/udp/PeerTestEvent.java	213e542e2b0d3bb0d4501e29cc62dd772054d01e
+++ router/java/src/net/i2p/router/transport/udp/PeerTestEvent.java	bba9a58b0b6be38a0b4fa5fd3aa0efcd71dbd224
@@ -87,12 +87,20 @@ class PeerTestEvent extends SimpleTimer2
      *  @since 0.9.13
      */
     public synchronized void forceRunSoon(boolean isIPv6) {
+        forceRunSoon(isIPv6, MIN_TEST_FREQUENCY);
+    }
+        
+    /**
+     *  Run within the specified time at the latest
+     *  @since 0.9.39
+     */
+    public synchronized void forceRunSoon(boolean isIPv6, long delay) {
         if (!isIPv6 && _transport.isIPv4Firewalled())
             return;
         if (isIPv6 && _transport.isIPv6Firewalled())
             return;
         _forceRun = isIPv6 ? FORCE_IPV6 : FORCE_IPV4;
-        reschedule(MIN_TEST_FREQUENCY);
+        reschedule(delay);
     }
         
     /**
============================================================
--- router/java/src/net/i2p/router/transport/udp/UDPTransport.java	67540d7a57d681086701db0defcd869fce64192e
+++ router/java/src/net/i2p/router/transport/udp/UDPTransport.java	39567600fb27d5fb61144480af6ea573bad4760d
@@ -532,7 +532,8 @@ public class UDPTransport extends Transp
         _expireEvent.setIsAlive(true);
         _reachabilityStatus = Status.UNKNOWN;
         _testEvent.setIsAlive(true); // this queues it for 3-6 minutes in the future...
-        _testEvent.reschedule(10*1000); // lets requeue it for Real Soon
+        boolean v6only = getIPv6Config() == IPV6_ONLY;
+        _testEvent.forceRunSoon(v6only, 10*1000); // lets requeue it for Real Soon
 
         // set up external addresses
         // REA param is false;

comment:3 Changed 9 months ago by zzz

Resolution: fixed
Status: acceptedclosed

Modified from the patch above to ensure that force always forces, and simplify the code.
In aed5aa391dbf4e688ca2180565dda87a80510ae3 to be 0.9.38-11

Note: See TracTickets for help on using tickets.