Changeset 0f094da


Ignore:
Timestamp:
Oct 6, 2011 4:07:51 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
de71286
Parents:
0c3f84c
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/networkdb/kademlia/RepublishLeaseSetJob.java

    r0c3f84c r0f094da  
    2222 */
    2323public class RepublishLeaseSetJob extends JobImpl {
    24     private Log _log;
     24    private final Log _log;
    2525    private final static long REPUBLISH_LEASESET_DELAY = 5*60*1000;
    26     public final static long REPUBLISH_LEASESET_TIMEOUT = 90*1000;
    27     private Hash _dest;
    28     private KademliaNetworkDatabaseFacade _facade;
     26    public final static long REPUBLISH_LEASESET_TIMEOUT = 60*1000;
     27    private final static int RETRY_DELAY = 20*1000;
     28    private final Hash _dest;
     29    private final KademliaNetworkDatabaseFacade _facade;
    2930    /** this is actually last attempted publish */
    3031    private long _lastPublished;
     
    3536        _facade = facade;
    3637        _dest = destHash;
    37         _lastPublished = 0;
    3838        //getTiming().setStartAfter(ctx.clock().now()+REPUBLISH_LEASESET_DELAY);
    3939    }
     40
    4041    public String getName() { return "Republish a local leaseSet"; }
     42
    4143    public void runJob() {
    4244        if (!getContext().clientManager().shouldPublishLeaseSet(_dest))
     
    6264                        _log.warn("Client " + _dest + " is local, but we can't find a valid LeaseSet?  perhaps its being rebuilt?");
    6365                }
    64                 if (false) { // floodfill doesnt require republishing
    65                     long republishDelay = getContext().random().nextLong(2*REPUBLISH_LEASESET_DELAY);
    66                     requeue(republishDelay);
    67                 }
     66                //if (false) { // floodfill doesnt require republishing
     67                //    long republishDelay = getContext().random().nextLong(2*REPUBLISH_LEASESET_DELAY);
     68                //    requeue(republishDelay);
     69                //}
    6870                return;
    6971            } else {
     
    8284    void requeueRepublish() {
    8385        if (_log.shouldLog(Log.WARN))
    84             _log.warn("FAILED publishing of the leaseSet for " + _dest.toBase64());
    85         requeue(getContext().random().nextInt(60*1000));
     86            _log.warn("FAILED publishing of the leaseSet for " + _dest);
     87        getContext().jobQueue().removeJob(this);
     88        requeue(RETRY_DELAY + getContext().random().nextInt(RETRY_DELAY));
    8689    }
    8790
     
    9093    }
    9194
     95    /** TODO - does nothing, remove */
    9296    private static class OnRepublishSuccess extends JobImpl {
    9397        public OnRepublishSuccess(RouterContext ctx) { super(ctx); }
Note: See TracChangeset for help on using the changeset viewer.