Changeset 0108c1c


Ignore:
Timestamp:
Nov 13, 2016 1:48:38 PM (4 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
3ac8e5f5
Parents:
a8976d2
Message:

i2psnark: Periodically DHT nodes (ticket #1328)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/dht/KRPC.java

    ra8976d2 r0108c1c  
    124124    private final AtomicLong _txBytes = new AtomicLong();
    125125    private long _started;
     126    private long _nodesLastSaved;
    126127
    127128    /** all-zero NID used for pings */
     
    157158    private static final long EXPLORE_TIME = 877*1000;
    158159    private static final long BLACKLIST_CLEAN_TIME = 17*60*1000;
     160    private static final long NODES_SAVE_TIME = 3*60*60*1000;
    159161    public static final String DHT_FILE_SUFFIX = ".dht.dat";
    160162
     
    636638        _rxBytes.set(0);
    637639        _started = _context.clock().now();
     640        _nodesLastSaved = _started;
    638641    }
    639642
     
    16761679                    iter.remove();
    16771680            }
     1681            if (now - _nodesLastSaved > NODES_SAVE_TIME) {
     1682                PersistDHT.saveDHT(_knownNodes, false, _dhtFile);
     1683                _nodesLastSaved = now;
     1684            }
    16781685            // TODO sent queries?
    16791686            if (_log.shouldLog(Log.DEBUG))
Note: See TracChangeset for help on using the changeset viewer.