Changeset b43114f


Ignore:
Timestamp:
Sep 1, 2005 12:20:16 AM (15 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
ccb7343
Parents:
9bd87ab
git-author:
jrandom <jrandom> (09/01/05 00:20:16)
git-committer:
zzz <zzz@…> (09/01/05 00:20:16)
Message:

2005-08-31 jrandom

  • Don't publish leaseSets to the netDb if they will never be looked for - namely, if they are for destinations that only establish outbound streams. I2PTunnel's 'client' and 'httpclient' proxies have been modified to tell the router that it doesn't need to publish their leaseSet (by setting the I2CP config option 'i2cp.dontPublishLeaseSet' to 'true').
  • Don't publish the top 10 peer rankings of each router in the netdb, as it isn't being watched right now.
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java

    r9bd87ab rb43114f  
    102102        this.handlerName = handlerName + _clientId;
    103103
     104        // no need to load the netDb with leaseSets for destinations that will never
     105        // be looked up
     106        tunnel.getClientOptions().setProperty("i2cp.dontPublishLeaseSet", "true");
     107       
    104108        while (sockMgr == null) {
    105109            synchronized (sockLock) {
  • router/java/src/net/i2p/router/ClientManagerFacade.java

    r9bd87ab rb43114f  
    2626 */
    2727public abstract class ClientManagerFacade implements Service {
     28    public static final String PROP_CLIENT_ONLY = "i2cp.dontPublishLeaseSet";
    2829   
    2930    /**
     
    7273   
    7374    public boolean verifyClientLiveliness() { return true; }
     75    /**
     76     * Does the client specified want their leaseSet published?
     77     */
     78    public boolean shouldPublishLeaseSet(Hash destinationHash) { return true; }
    7479
    7580
  • router/java/src/net/i2p/router/RouterVersion.java

    r9bd87ab rb43114f  
    1616 */
    1717public class RouterVersion {
    18     public final static String ID = "$Revision: 1.220 $ $Date: 2005/08/27 17:15:38 $";
     18    public final static String ID = "$Revision: 1.221 $ $Date: 2005/08/29 20:59:13 $";
    1919    public final static String VERSION = "0.6.0.3";
    20     public final static long BUILD = 4;
     20    public final static long BUILD = 5;
    2121    public static void main(String args[]) {
    2222        System.out.println("I2P Router version: " + VERSION);
  • router/java/src/net/i2p/router/client/ClientManager.java

    r9bd87ab rb43114f  
    2626import net.i2p.data.i2cp.SessionConfig;
    2727import net.i2p.router.ClientMessage;
     28import net.i2p.router.ClientManagerFacade;
    2829import net.i2p.router.Job;
    2930import net.i2p.router.JobImpl;
     
    270271    }
    271272   
     273    public boolean shouldPublishLeaseSet(Hash destHash) {
     274        if (destHash == null) return true;
     275        ClientConnectionRunner runner = getRunner(destHash);
     276        if (runner == null) return true;
     277        String dontPublish = runner.getConfig().getOptions().getProperty(ClientManagerFacade.PROP_CLIENT_ONLY);
     278        if ( (dontPublish != null) && ("true".equals(dontPublish)) )
     279            return false;
     280        return true;
     281    }
     282
    272283    public Set listClients() {
    273284        Set rv = new HashSet();
  • router/java/src/net/i2p/router/client/ClientManagerFacadeImpl.java

    r9bd87ab rb43114f  
    165165        }
    166166    }
     167
     168    public boolean shouldPublishLeaseSet(Hash destinationHash) { return _manager.shouldPublishLeaseSet(destinationHash); }
    167169   
    168170    public void messageDeliveryStatusUpdate(Destination fromDest, MessageId id, boolean delivered) {
  • router/java/src/net/i2p/router/networkdb/HandleDatabaseLookupMessageJob.java

    r9bd87ab rb43114f  
    7676        LeaseSet ls = getContext().netDb().lookupLeaseSetLocally(_message.getSearchKey());
    7777        if (ls != null) {
     78            boolean publish = getContext().clientManager().shouldPublishLeaseSet(_message.getSearchKey());
     79       
    7880            // only answer a request for a LeaseSet if it has been published
    7981            // to us, or, if its local, if we would have published to ourselves
    80             if (answerAllQueries() || ls.getReceivedAsPublished()) {
     82            if (publish && (answerAllQueries() || ls.getReceivedAsPublished())) {
    8183                getContext().statManager().addRateData("netDb.lookupsMatchedReceivedPublished", 1, 0);
    8284                sendData(_message.getSearchKey(), ls, fromKey, _message.getReplyTunnel());
     
    8688                                                                            _message.getDontIncludePeers());
    8789                if (getContext().clientManager().isLocal(ls.getDestination())) {
    88                     if (weAreClosest(routerInfoSet)) {
     90                    if (publish && weAreClosest(routerInfoSet)) {
    8991                        getContext().statManager().addRateData("netDb.lookupsMatchedLocalClosest", 1, 0);
    9092                        sendData(_message.getSearchKey(), ls, fromKey, _message.getReplyTunnel());
  • router/java/src/net/i2p/router/networkdb/kademlia/DataPublisherJob.java

    r9bd87ab rb43114f  
    5555                                  new Exception("Publish expired lease?"));
    5656                }
     57                if (!getContext().clientManager().shouldPublishLeaseSet(key))
     58                    continue;
    5759            }
    5860            _facade.sendStore(key, data, null, null, STORE_TIMEOUT, null);
  • router/java/src/net/i2p/router/networkdb/kademlia/DataRepublishingSelectorJob.java

    r9bd87ab rb43114f  
    136136                LeaseSet ls = _facade.lookupLeaseSetLocally(key);
    137137                if (ls != null) {
     138                    if (!getContext().clientManager().shouldPublishLeaseSet(ls.getDestination().calculateHash()))
     139                        return -3;
    138140                    if (ls.isCurrent(Router.CLOCK_FUDGE_FACTOR)) {
    139141                        // last time it was sent was before the last send period
  • router/java/src/net/i2p/router/networkdb/kademlia/DataStore.java

    r9bd87ab rb43114f  
    2121    public Set getKeys();
    2222    public void restart();
     23    public int countLeaseSets();
     24
    2325}
  • router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java

    r9bd87ab rb43114f  
    383383   
    384384    public int getKnownLeaseSets() { 
    385         if (_kb == null) return 0;
    386         CountLeaseSets count = new CountLeaseSets();
    387         _kb.getAll(count);
    388         return count.size();
     385        if (_ds == null) return 0;
     386        return _ds.countLeaseSets();
    389387    }
    390388   
     
    477475            return;
    478476        }
     477        if (!_context.clientManager().shouldPublishLeaseSet(h))
     478            return;
     479       
    479480        synchronized (_explicitSendKeys) {
    480481            _explicitSendKeys.add(h);
  • router/java/src/net/i2p/router/networkdb/kademlia/PersistentDataStore.java

    r9bd87ab rb43114f  
    5858        super.put(key, data);
    5959        _context.jobQueue().addJob(new WriteJob(key, data));
     60    }
     61   
     62    public int countLeaseSets() {
     63        File dbDir = null;
     64        try {
     65            dbDir = getDbDir();
     66        } catch (IOException ioe) {
     67            return 0;
     68        }
     69        if (dbDir == null)
     70            return 0;
     71        File leaseSetFiles[] = dbDir.listFiles(LeaseSetFilter.getInstance());
     72        if (leaseSetFiles == null)
     73            return 0;
     74        else
     75            return leaseSetFiles.length;
    6076    }
    6177   
  • router/java/src/net/i2p/router/networkdb/kademlia/RepublishLeaseSetJob.java

    r9bd87ab rb43114f  
    3838    public String getName() { return "Republish a local leaseSet"; }
    3939    public void runJob() {
     40        if (!getContext().clientManager().shouldPublishLeaseSet(_dest))
     41            return;
     42       
    4043        try {
    4144            if (getContext().clientManager().isLocal(_dest)) {
  • router/java/src/net/i2p/router/networkdb/kademlia/TransientDataStore.java

    r9bd87ab rb43114f  
    6060        }
    6161    }
     62
     63    public int countLeaseSets() { return 0; }
     64
    6265   
    6366    /** nothing published more than 5 minutes in the future */
  • router/java/src/net/i2p/router/peermanager/PeerTestJob.java

    r9bd87ab rb43114f  
    3131    private PeerManager _manager;
    3232    private boolean _keepTesting;
    33     private static final long DEFAULT_PEER_TEST_DELAY = 60*1000;
     33    private static final long DEFAULT_PEER_TEST_DELAY = 5*60*1000;
    3434    private static final int TEST_PRIORITY = 100;
    3535   
     
    4949    private int getTestTimeout() { return 30*1000; }
    5050    /** number of peers to test each round */
    51     private int getTestConcurrency() { return 2; }
     51    private int getTestConcurrency() { return 1; }
    5252   
    5353    public void startTesting(PeerManager manager) {
  • router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java

    r9bd87ab rb43114f  
    744744        if (netDb == null) return true;
    745745        if (_context.router() == null) return true;
    746         if ( (_context.shitlist() != null) && (_context.shitlist().isShitlisted(peer)) )
     746        if ( (_context.shitlist() != null) && (_context.shitlist().isShitlisted(peer)) ) {
     747            if (_log.shouldLog(Log.DEBUG))
     748                _log.debug("Peer " + peer.toBase64() + " is shitlisted, dont select it");
    747749            return false; // never select a shitlisted peer
     750        }
    748751           
    749752        if (null != netDb.lookupRouterInfoLocally(peer)) {
Note: See TracChangeset for help on using the changeset viewer.