Changeset 566df1c


Ignore:
Timestamp:
Feb 26, 2019 4:19:36 PM (18 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
cf1c0cb3
Parents:
16421fa
Message:

SSU: Fix scheduling of peer test at startup (ticket #2441)

Location:
router/java/src/net/i2p/router/transport/udp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/transport/udp/PeerTestEvent.java

    r16421fa r566df1c  
    4646            boolean configV4fw = _transport.isIPv4Firewalled();
    4747            boolean configV6fw = _transport.isIPv6Firewalled();
    48             if (!configV4fw && _forceRun == FORCE_IPV4 && sinceRunV4 >= MIN_TEST_FREQUENCY) {
     48            if (!configV4fw && (_forceRun == FORCE_IPV4 || sinceRunV4 >= MIN_TEST_FREQUENCY)) {
    4949                locked_runTest(false);
    50             } else if (!configV6fw && _transport.hasIPv6Address() &&_forceRun == FORCE_IPV6 && sinceRunV6 >= MIN_TEST_FREQUENCY) {
     50            } else if (!configV6fw && _transport.hasIPv6Address() && (_forceRun == FORCE_IPV6 || sinceRunV6 >= MIN_TEST_FREQUENCY)) {
    5151                locked_runTest(true);
    5252            } else if (!configV4fw && sinceRunV4 >= TEST_FREQUENCY && _transport.getIPv6Config() != IPV6_ONLY) {
     
    8888     */
    8989    public synchronized void forceRunSoon(boolean isIPv6) {
     90        forceRunSoon(isIPv6, MIN_TEST_FREQUENCY);
     91    }
     92       
     93    /**
     94     *  Run within the specified time at the latest
     95     *  @since 0.9.39
     96     */
     97    public synchronized void forceRunSoon(boolean isIPv6, long delay) {
    9098        if (!isIPv6 && _transport.isIPv4Firewalled())
    9199            return;
     
    93101            return;
    94102        _forceRun = isIPv6 ? FORCE_IPV6 : FORCE_IPV4;
    95         reschedule(MIN_TEST_FREQUENCY);
     103        reschedule(delay);
    96104    }
    97105       
     
    102110     */
    103111    public synchronized void forceRunImmediately(boolean isIPv6) {
    104         if (!isIPv6 && _transport.isIPv4Firewalled())
    105             return;
    106         if (isIPv6 && _transport.isIPv6Firewalled())
    107             return;
    108         if (isIPv6)
    109             _lastTestedV6.set(0);
    110         else
    111             _lastTested.set(0);
    112         _forceRun = isIPv6 ? FORCE_IPV6 : FORCE_IPV4;
    113         reschedule(5*1000);
     112        forceRunSoon(isIPv6, 5*1000);
    114113    }
    115114       
  • router/java/src/net/i2p/router/transport/udp/UDPTransport.java

    r16421fa r566df1c  
    533533        _reachabilityStatus = Status.UNKNOWN;
    534534        _testEvent.setIsAlive(true); // this queues it for 3-6 minutes in the future...
    535         _testEvent.reschedule(10*1000); // lets requeue it for Real Soon
     535        boolean v6only = getIPv6Config() == IPV6_ONLY;
     536        _testEvent.forceRunSoon(v6only, 10*1000); // lets requeue it for Real Soon
    536537
    537538        // set up external addresses
Note: See TracChangeset for help on using the changeset viewer.