Changeset 5b4be5b


Ignore:
Timestamp:
Oct 16, 2009 8:16:29 PM (11 years ago)
Author:
z3d <z3d@…>
Branches:
master
Children:
4651b70
Parents:
9c2c90c (diff), bdd0c3f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge of '74266b0afe4ef1abef923c8389fb47263b9a39e1'

and '9a62d1aa11b74d835ec795c0a303bf5c2ebc2793'

Files:
20 edited
3 moved

Legend:

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

    r9c2c90c r5b4be5b  
    695695    }
    696696
     697    /**
     698     *  "name", "announceURL=websiteURL" pairs
     699     */
    697700    private static final String DEFAULT_TRACKERS[] = {
    698701//       "Postman", "http://YRgrgTLGnbTq2aZOZDJQ~o6Uk5k6TK-OZtx0St9pb0G-5EGYURZioxqYG8AQt~LgyyI~NCj6aYWpPO-150RcEvsfgXLR~CxkkZcVpgt6pns8SRc3Bi-QSAkXpJtloapRGcQfzTtwllokbdC-aMGpeDOjYLd8b5V9Im8wdCHYy7LRFxhEtGb~RL55DA8aYOgEXcTpr6RPPywbV~Qf3q5UK55el6Kex-6VCxreUnPEe4hmTAbqZNR7Fm0hpCiHKGoToRcygafpFqDw5frLXToYiqs9d4liyVB-BcOb0ihORbo0nS3CLmAwZGvdAP8BZ7cIYE3Z9IU9D1G8JCMxWarfKX1pix~6pIA-sp1gKlL1HhYhPMxwyxvuSqx34o3BqU7vdTYwWiLpGM~zU1~j9rHL7x60pVuYaXcFQDR4-QVy26b6Pt6BlAZoFmHhPcAuWfu-SFhjyZYsqzmEmHeYdAwa~HojSbofg0TMUgESRXMw6YThK1KXWeeJVeztGTz25sL8AAAA.i2p/announce.php=http://tracker.postman.i2p/"
     
    706709//       , "Galen", "http://5jpwQMI5FT303YwKa5Rd38PYSX04pbIKgTaKQsWbqoWjIfoancFdWCShXHLI5G5ofOb0Xu11vl2VEMyPsg1jUFYSVnu4-VfMe3y4TKTR6DTpetWrnmEK6m2UXh91J5DZJAKlgmO7UdsFlBkQfR2rY853-DfbJtQIFl91tbsmjcA5CGQi4VxMFyIkBzv-pCsuLQiZqOwWasTlnzey8GcDAPG1LDcvfflGV~6F5no9mnuisZPteZKlrv~~TDoXTj74QjByWc4EOYlwqK8sbU9aOvz~s31XzErbPTfwiawiaZ0RUI-IDrKgyvmj0neuFTWgjRGVTH8bz7cBZIc3viy6ioD-eMQOrXaQL0TCWZUelRwHRvgdPiQrxdYQs7ixkajeHzxi-Pq0EMm5Vbh3j3Q9kfUFW3JjFDA-MLB4g6XnjCbM5J1rC0oOBDCIEfhQkszru5cyLjHiZ5yeA0VThgu~c7xKHybv~OMXION7V8pBKOgET7ZgAkw1xgYe3Kkyq5syAAAA.i2p/tr/announce.php=http://galen.i2p/tr/"
    707710       "POSTMAN", "http://tracker2.postman.i2p/announce.php=http://tracker2.postman.i2p/"
    708        ,"WELTERDE", "http://BGKmlDOoH3RzFbPRfRpZV2FjpVj8~3moFftw5-dZfDf2070TOe8Tf2~DAVeaM6ZRLdmFEt~9wyFL8YMLMoLoiwGEH6IGW6rc45tstN68KsBDWZqkTohV1q9XFgK9JnCwE~Oi89xLBHsLMTHOabowWM6dkC8nI6QqJC2JODqLPIRfOVrDdkjLwtCrsckzLybNdFmgfoqF05UITDyczPsFVaHtpF1sRggOVmdvCM66otyonlzNcJbn59PA-R808vUrCPMGU~O9Wys0i-NoqtIbtWfOKnjCRFMNw5ex4n9m5Sxm9e20UkpKG6qzEuvKZWi8vTLe1NW~CBrj~vG7I3Ok4wybUFflBFOaBabxYJLlx4xTE1zJIVxlsekmAjckB4v-cQwulFeikR4LxPQ6mCQknW2HZ4JQIq6hL9AMabxjOlYnzh7kjOfRGkck8YgeozcyTvcDUcUsOuSTk06L4kdrv8h2Cozjbloi5zl6KTbj5ZTciKCxi73Pn9grICn-HQqEAAAA.i2p/a=http://tracker.welterde.i2p/stats?mode=top5"
     711       ,"WELTERDE", "http://tracker.welterde.i2p/a=http://tracker.welterde.i2p/stats?mode=top5"
    709712       , "CRSTRACK", "http://b4G9sCdtfvccMAXh~SaZrPqVQNyGQbhbYMbw6supq2XGzbjU4NcOmjFI0vxQ8w1L05twmkOvg5QERcX6Mi8NQrWnR0stLExu2LucUXg1aYjnggxIR8TIOGygZVIMV3STKH4UQXD--wz0BUrqaLxPhrm2Eh9Hwc8TdB6Na4ShQUq5Xm8D4elzNUVdpM~RtChEyJWuQvoGAHY3ppX-EJJLkiSr1t77neS4Lc-KofMVmgI9a2tSSpNAagBiNI6Ak9L1T0F9uxeDfEG9bBSQPNMOSUbAoEcNxtt7xOW~cNOAyMyGydwPMnrQ5kIYPY8Pd3XudEko970vE0D6gO19yoBMJpKx6Dh50DGgybLQ9CpRaynh2zPULTHxm8rneOGRcQo8D3mE7FQ92m54~SvfjXjD2TwAVGI~ae~n9HDxt8uxOecAAvjjJ3TD4XM63Q9TmB38RmGNzNLDBQMEmJFpqQU8YeuhnS54IVdUoVQFqui5SfDeLXlSkh4vYoMU66pvBfWbAAAA.i2p/tracker/announce.php=http://crstrack.i2p/tracker/"
    710 
     713       , "ThePirateBay", "http://tracker.thepiratebay.i2p/announce=http://thepiratebay.i2p/"
    711714    };
    712715   
  • apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java

    r9c2c90c r5b4be5b  
    506506        String announce = snark.meta.getAnnounce();
    507507        if (announce.startsWith("http://YRgrgTLG") || announce.startsWith("http://8EoJZIKr") ||
     508            announce.startsWith("http://4svjpPox") || announce.startsWith("http://tracker.thepiratebay.i2p/") ||
    508509            announce.startsWith("http://lnQ6yoBT") || announce.startsWith("http://tracker2.postman.i2p/")) {
    509510            Map trackers = _manager.getTrackers();
     
    513514                String baseURL = (String)entry.getValue();
    514515                if (!(baseURL.startsWith(announce) || // vvv hack for non-b64 announce in list vvv
    515                       (announce.startsWith("http://lnQ6yoBT") && baseURL.startsWith("http://tracker2.postman.i2p/"))))
     516                      (announce.startsWith("http://lnQ6yoBT") && baseURL.startsWith("http://tracker2.postman.i2p/")) ||
     517                      (announce.startsWith("http://4svjpPox") && baseURL.startsWith("http://thepiratebay.i2p/"))))
    516518                    continue;
    517519                int e = baseURL.indexOf('=');
  • apps/routerconsole/java/src/net/i2p/router/web/ProfileOrganizerRenderer.java

    r9c2c90c r5b4be5b  
    1 package net.i2p.router.peermanager;
     1package net.i2p.router.web;
    22
    33import java.io.IOException;
     
    1313import net.i2p.data.RouterInfo;
    1414import net.i2p.router.RouterContext;
     15import net.i2p.router.peermanager.DBHistory;
     16import net.i2p.router.peermanager.PeerProfile;
     17import net.i2p.router.peermanager.ProfileOrganizer;
    1518import net.i2p.stat.Rate;
    1619import net.i2p.stat.RateStat;
  • apps/routerconsole/java/src/net/i2p/router/web/ProfilesHelper.java

    r9c2c90c r5b4be5b  
    11package net.i2p.router.web;
    22
    3 import java.io.ByteArrayOutputStream;
    43import java.io.IOException;
    5 import java.io.OutputStreamWriter;
    64
    75
     
    97    public ProfilesHelper() {}
    108   
     9    /** @return empty string, writes directly to _out */
    1110    public String getProfileSummary() {
    12         ByteArrayOutputStream baos = new ByteArrayOutputStream(16*1024);
    1311        try {
    14             _context.profileOrganizer().renderStatusHTML(new OutputStreamWriter(baos));
     12            ProfileOrganizerRenderer rend = new ProfileOrganizerRenderer(_context.profileOrganizer(), _context);
     13            rend.renderStatusHTML(_out);
    1514        } catch (IOException ioe) {
    1615            ioe.printStackTrace();
    1716        }
    18         return new String(baos.toByteArray());
     17        return "";
    1918    }
    2019   
     20    /** @return empty string, writes directly to _out */
    2121    public String getShitlistSummary() {
    22         ByteArrayOutputStream baos = new ByteArrayOutputStream(4*1024);
    2322        try {
    24             _context.shitlist().renderStatusHTML(new OutputStreamWriter(baos));
     23            _context.shitlist().renderStatusHTML(_out);
    2524        } catch (IOException ioe) {
    2625            ioe.printStackTrace();
    2726        }
    28         return new String(baos.toByteArray());
     27        return "";
    2928    }
    3029}
  • apps/routerconsole/jsp/configpeer.jsp

    r9c2c90c r5b4be5b  
    6767 <jsp:useBean class="net.i2p.router.web.ProfilesHelper" id="profilesHelper" scope="request" />
    6868 <jsp:setProperty name="profilesHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
     69 <jsp:setProperty name="profilesHelper" property="writer" value="<%=out%>" />
    6970 <jsp:getProperty name="profilesHelper" property="shitlistSummary" />
    7071 <div class="wideload">
  • apps/routerconsole/jsp/profiles.jsp

    r9c2c90c r5b4be5b  
    1010 <jsp:useBean class="net.i2p.router.web.ProfilesHelper" id="profilesHelper" scope="request" />
    1111 <jsp:setProperty name="profilesHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
     12 <jsp:setProperty name="profilesHelper" property="writer" value="<%=out%>" />
    1213 <jsp:getProperty name="profilesHelper" property="profileSummary" />
    1314 <a name="shitlist"> </a>
  • history.txt

    r9c2c90c r5b4be5b  
     12009-10-16 zzz
     2    * Crypto: Two more test classes out of the lib
     3    * FloodfillMonitor: Slow down the volunteers again
     4    * oldconsole.jsp: Remove almost all of it, add lines for tino
     5    * MessageHistory: Cleanups
     6    * NetDb: Rework part 1 of N:
     7      - Flood only to those closest to the key
     8      - Java 5 fixups
     9    * ProfileOrganizerRenderer:
     10      - Move to routerconsole
     11      - Write directly to Writer for speed
     12    * Router: Add router.hideFloodfillParticipant option for testing
     13    * StatisticsManager: Cleanup after release
     14
    115* 2009-10-12  0.7.7 released
    216
  • hosts.txt

    r9c2c90c r5b4be5b  
    320320docs.i2p2.i2p=BhSHFwXW7zGTLRVTRuTfgxWC1PxKGDyY2OYpS0IrDnYhQklWVFxHz4xVpw8UXo8LTFXAnAjknrcYdLt6DfHcO-ZkFPo5UbOIfywSsHoet4J6BQ1MOt1MLTAejks4Rkj3~sfK2fJHHvHYTjm1v5~f8c13ZH5fPfQ3A71RRCyiYaeO5-VxC6rqvW~z0dNO~-jakjwD7tHtzQL2vQTqarYT859yUiHmLJ~yw5jXfxNBhlxIxaXg0Nat9S5N2W4Eqemy-UYtSGOM4IUGKoM902JxhVpz~O1~iB5H211E3x-o8dKTt9Yz2G5Qcp1kRB0NCO2Noivsxjnfv~64zoUVbPepyJFQKenRtX844HgOESNcUp~FoVzI~QJne5irJDMLK1dNsua3L1kz0MA-2Aev8byWe4TIXeZCuDpYi4bRK6OPKDETwJG8edw7CFtsQaFI-2wGMFu8GDH7pUL8~1qyDjjFv5c~q1MFhty9q8LRUGHHgWP47u9n8OX4zcS4P1~5z2M3AAAA
    321321paste.i2p2.i2p=PbHXL5PXan7siJiFcUAV~VC0JCLxgnoOnZFjyvJ0dbYlQ3fi1K6SD961pjQ51OSeTnbe5iGRzbY2X0~pG4k~hexau4NizxprAdgdiC-4J3-xpVRjZ4IxuMoDXp-V8Nhv8pLCQcxiEXbWft2v7zLvkp2y6uqH7kab8FXL~z568rMMH0DDs8imwAawasyGtLLo77X8n-C0K~7orcWDVZicWABJ-zky1Zlllx~Y~S8RHWyN4dueP6wkH484b81xNbbt3P-HzE3TcKAvUcSV1Bq4J5UNafQYU7DhV7roUtw4HuJYoxiXnlXVeC-uTCGF~bPrjrB-~Yn0KyObmXs5yvAcKHIS2tgmlsP9nahyn1ZOrlZc0L3DEsv4rkfQyzHVBxcCzMUOchWehE09GLy3bviWZ43lB7kU8kRaja7G4xLrD-CXNXq6q7WNYXrqX7EmtsvCo8VDcFn2ODyLb3eyDe~CkO7ES7mv3u8jJxJRQEcjj71pvu7bMzSMh-xN08X6vx9AAAAA
     322thepiratebay.i2p=9Sng0F-cAyGgPyr1xenqY87Uf2AG~PlTXzUJRQnr7gpYFPUfRlH3OfWOVFat67jUl37ZzWBOSYC7-6YqFzPQV5u~DrTGaoImfa7BsRbnBlPXbSNIaP59C6Vp1RCbhtTpxQ4PvLLn9xzUKWoPkrQ222TCSxPR6-j2ChSuuCIA7bP7EP75BobL6n9hMmekzB4FbmBhC64Kri72Uhv~rMDdMZaDD9cD9-BgnZkyrI5jRtSuOUVnTexKMQ0UiYHanSDlBvNwLRMGdb0AsckOdXHrleKrwPnW4YTp0q89dPGP6fad4sVxgvxLHF6NuoWXGbnD0sYuv5qkegjBzioHOjxI~n52ObdeELVhs~peeiXpRavZcwlu1HzwNKfU8lJrpnLSoQsCuqd4OBFMmjvo3HhovLsTeUAo1W2O1F8gcPeOj3tD0ihInncMIbEUTI7kdbkBTsoMY8~73jKgQYC0c~hiEUb1tG4NLcfdxgAlWF5q9cJPDHFh9jtzDvq63OntBQ5OAAAA
     323tracker.thepiratebay.i2p=4svjpPox0vc527neBdWyfLiVulEeHtzQrC6IDDB2~rPwnZYWm3xsyrDYTa9gu5~1QrFitr5RMCcj34tzZZCKIg~INFNhi7Zk7UwsOCHtedS0RpRjDi2O3q~T~k8D4P39Rz0So91D624lofDV48itdkX8B3dNUHE0Qq5hCGjb2UVxLUhKh8DYOUAqYPoLaF1RpQx5DT~r-Hf57vA9bW3Q31xYH~Ys6AxCZ8~EmMqdgm0ZMQ57oWldHgkSbtQsoiBn2igJ24GDUDUvBsRVLt7He1nKg1ei2JvqQajKN31cQeS5fjqiGdUTkXjc1FftKB8HC9CbnsMJjPEFT6gvvtSpxULvSQGSJyD6OIzebXvQIYANAapEk1VP1OSIJlteOIwGDXkGj9ZyLpT7~RpUpk92v9L53Zjof~WjJmGqqWWsL~yypl0~nMUw5MLaKv5AJywDnFIJDR-GlkQQj5fECeefge30Y92CHwxgImwj3v7~DwXuU9d5u6KyzJSuByOGRvwVAAAA
  • news.xml

    r9c2c90c r5b4be5b  
    2424drops by high-bandwidth routers.
    2525There is a new <a href="/configupdate.jsp">unsigned update option</a>
    26 for those of you that would like automatic udpates to bleeding-edge development versions.
     26for those of you that would like automatic updates to bleeding-edge development versions.
    2727</p><p>
    2828The release also contains several changes to reduce memory and CPU usage,
  • router/java/src/net/i2p/router/Router.java

    r9c2c90c r5b4be5b  
    464464        }
    465465       
    466         if (FloodfillNetworkDatabaseFacade.floodfillEnabled(_context))
     466        // if prop set to true, don't tell people we are ff even if we are
     467        if (FloodfillNetworkDatabaseFacade.floodfillEnabled(_context) &&
     468            !Boolean.valueOf(_context.getProperty("router.hideFloodfillParticipant")).booleanValue())
    467469            ri.addCapability(FloodfillNetworkDatabaseFacade.CAPACITY_FLOODFILL);
    468470       
    469         if("true".equalsIgnoreCase(_context.getProperty(Router.PROP_HIDDEN, "false")))
     471        if(Boolean.valueOf(_context.getProperty(PROP_HIDDEN)).booleanValue())
    470472            ri.addCapability(RouterInfo.CAPABILITY_HIDDEN);
    471473       
    472         String forceUnreachable = _context.getProperty(PROP_FORCE_UNREACHABLE);
    473         if ( (forceUnreachable != null) && ("true".equalsIgnoreCase(forceUnreachable)) ) {
     474        if (Boolean.valueOf(_context.getProperty(PROP_FORCE_UNREACHABLE)).booleanValue()) {
    474475            ri.addCapability(CAPABILITY_UNREACHABLE);
    475476            return;
     
    583584    }
    584585   
     586    /**
     587     *  this is for oldconsole.jsp, pretty much unused except as a way to get memory info,
     588     *  so let's comment out the rest, it is available elsewhere, and we don't really
     589     *  want to spend a minute rendering a multi-megabyte page in memory.
     590     */
    585591    public void renderStatusHTML(Writer out) throws IOException {
     592/****************
    586593        out.write("<h1>Router console</h1>\n" +
    587594                   "<i><a href=\"/oldconsole.jsp\">console</a> | <a href=\"/oldstats.jsp\">stats</a></i><br>\n" +
     
    600607                   "</select> <input type=\"submit\" value=\"GO\" /> </form>" +
    601608                   "<hr>\n");
    602 
    603         StringBuilder buf = new StringBuilder(32*1024);
    604        
     609**************/
     610
     611        StringBuilder buf = new StringBuilder(4*1024);
     612       
     613        // Please don't change the text or formatting, tino matches it in his scripts
    605614        if ( (_routerInfo != null) && (_routerInfo.getIdentity() != null) )
    606615            buf.append("<b>Router: </b> ").append(_routerInfo.getIdentity().getHash().toBase64()).append("<br>\n");
    607         buf.append("<b>As of: </b> ").append(new Date(_context.clock().now())).append(" (uptime: ").append(DataHelper.formatDuration(getUptime())).append(") <br>\n");
     616        buf.append("<b>As of: </b> ").append(new Date(_context.clock().now())).append("<br>\n");
     617        buf.append("<b>RouterUptime: </b> " ).append(DataHelper.formatDuration(getUptime())).append(" <br>\n");
    608618        buf.append("<b>Started on: </b> ").append(new Date(getWhenStarted())).append("<br>\n");
    609619        buf.append("<b>Clock offset: </b> ").append(_context.clock().getOffset()).append("ms (OS time: ").append(new Date(_context.clock().now() - _context.clock().getOffset())).append(")<br>\n");
     620        buf.append("<b>RouterVersion:</b> ").append(RouterVersion.FULL_VERSION).append(" / SDK: ").append(CoreVersion.VERSION).append("<br>\n");
    610621        long tot = Runtime.getRuntime().totalMemory()/1024;
    611622        long free = Runtime.getRuntime().freeMemory()/1024;
    612623        buf.append("<b>Memory:</b> In use: ").append((tot-free)).append("KB Free: ").append(free).append("KB <br>\n");
    613         buf.append("<b>Version:</b> Router: ").append(RouterVersion.VERSION).append(" / SDK: ").append(CoreVersion.VERSION).append("<br>\n");
    614624        if (_higherVersionSeen)
    615625            buf.append("<b><font color=\"red\">HIGHER VERSION SEEN</font><b> - please <a href=\"http://www.i2p.net/\">check</a> to see if there is a new release out<br>\n");
    616626
     627/*********
    617628        buf.append("<hr><a name=\"bandwidth\"> </a><h2>Bandwidth</h2>\n");
    618629        long sent = _context.bandwidthLimiter().getTotalAllocatedOutboundBytes();
     
    769780        }
    770781        buf.append("</table>\n");
     782***********/
    771783        out.write(buf.toString());
    772784        out.flush();
  • router/java/src/net/i2p/router/StatisticsManager.java

    r9c2c90c r5b4be5b  
    123123            //includeRate("crypto.elGamal.encrypt", stats, new long[] { 60*60*1000 });
    124124            // total event count can be used to track uptime
    125             boolean hideTotals = ! RouterVersion.VERSION.equals("0.7.6");
    126             includeRate("tunnel.participatingTunnels", stats, new long[] { 60*60*1000 }, hideTotals);
     125            includeRate("tunnel.participatingTunnels", stats, new long[] { 60*60*1000 }, true);
    127126            //includeRate("tunnel.testSuccessTime", stats, new long[] { 10*60*1000l });
    128127            //includeRate("client.sendAckTime", stats, new long[] { 60*60*1000 }, true);
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillMonitorJob.java

    r9c2c90c r5b4be5b  
    5151        // To do: somehow assess the size of the network to make this adaptive?
    5252        if (!ff)
    53             delay *= 3;
     53            delay *= 7;
    5454        requeue(delay);
    5555    }
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillNetworkDatabaseFacade.java

    r9c2c90c r5b4be5b  
    9595    }
    9696
     97    private static final int MAX_TO_FLOOD = 9;
     98
     99    /**
     100     *  Send to a subset of all floodfill peers.
     101     *  We do this to implement Kademlia within the floodfills, i.e.
     102     *  we flood to those closest to the key.
     103     */
    97104    public void flood(DataStructure ds) {
     105        Hash key;
     106        if (ds instanceof LeaseSet)
     107            key = ((LeaseSet)ds).getDestination().calculateHash();
     108        else
     109            key = ((RouterInfo)ds).getIdentity().calculateHash();
     110        Hash rkey = _context.routingKeyGenerator().getRoutingKey(key);
    98111        FloodfillPeerSelector sel = (FloodfillPeerSelector)getPeerSelector();
    99         List peers = sel.selectFloodfillParticipants(getKBuckets());
     112        List peers = sel.selectFloodfillParticipants(rkey, MAX_TO_FLOOD, getKBuckets());
    100113        int flooded = 0;
    101114        for (int i = 0; i < peers.size(); i++) {
     
    108121            DatabaseStoreMessage msg = new DatabaseStoreMessage(_context);
    109122            if (ds instanceof LeaseSet) {
    110                 msg.setKey(((LeaseSet)ds).getDestination().calculateHash());
    111123                msg.setLeaseSet((LeaseSet)ds);
    112124            } else {
    113                 msg.setKey(((RouterInfo)ds).getIdentity().calculateHash());
    114125                msg.setRouterInfo((RouterInfo)ds);
    115126            }
     127            msg.setKey(key);
    116128            msg.setReplyGateway(null);
    117129            msg.setReplyToken(0);
     
    126138            flooded++;
    127139            if (_log.shouldLog(Log.INFO))
    128                 _log.info("Flooding the entry for " + msg.getKey().toBase64() + " to " + peer.toBase64());
     140                _log.info("Flooding the entry for " + key.toBase64() + " to " + peer.toBase64());
    129141        }
    130142       
    131143        if (_log.shouldLog(Log.INFO))
    132             _log.info("Flooded the to " + flooded + " peers");
     144            _log.info("Flooded the data to " + flooded + " of " + peers.size() + " peers");
    133145    }
    134146
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillPeerSelector.java

    r9c2c90c r5b4be5b  
    3333     */
    3434    @Override
    35     public List selectMostReliablePeers(Hash key, int maxNumRouters, Set peersToIgnore, KBucketSet kbuckets) {
     35    public List<Hash> selectMostReliablePeers(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet kbuckets) {
    3636        return selectNearestExplicitThin(key, maxNumRouters, peersToIgnore, kbuckets, true);
    3737    }
    3838
    3939    @Override
    40     public List selectNearestExplicitThin(Hash key, int maxNumRouters, Set peersToIgnore, KBucketSet kbuckets) {
     40    public List<Hash> selectNearestExplicitThin(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet kbuckets) {
    4141        return selectNearestExplicitThin(key, maxNumRouters, peersToIgnore, kbuckets, false);
    4242    }
    4343
    44     public List selectNearestExplicitThin(Hash key, int maxNumRouters, Set peersToIgnore, KBucketSet kbuckets, boolean preferConnected) {
     44    public List<Hash> selectNearestExplicitThin(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet kbuckets, boolean preferConnected) {
    4545        if (peersToIgnore == null)
    4646            peersToIgnore = new HashSet(1);
     
    5757    }
    5858   
    59     /** Returned list will not include our own hash */
    60     public List selectFloodfillParticipants(KBucketSet kbuckets) {
     59    /**
     60     *  @return all floodfills not shitlisted forever. list will not include our own hash
     61     *
     62     */
     63    public List<Hash> selectFloodfillParticipants(KBucketSet kbuckets) {
    6164        if (kbuckets == null) return new ArrayList();
    6265        FloodfillSelectionCollector matches = new FloodfillSelectionCollector(null, null, 0);
     
    6568    }
    6669   
     70    /**
     71     *  @return all floodfills not shitlisted foreverx
     72     *  @param maxNumRouters max to return
     73     *  Sorted by closest to the key if > maxNumRouters, otherwise not
     74     */
     75    public List<Hash> selectFloodfillParticipants(Hash key, int maxNumRouters, KBucketSet kbuckets) {
     76        List<Hash> ffs = selectFloodfillParticipants(kbuckets);
     77        if (ffs.size() <= maxNumRouters)
     78            return ffs; // unsorted
     79        TreeMap<BigInteger, Hash> sorted = new TreeMap();
     80        for (int i = 0; i < ffs.size(); i++) {
     81            Hash h = ffs.get(i);
     82            BigInteger diff = getDistance(key, h);
     83            sorted.put(diff, h);
     84        }
     85        List<Hash> rv = new ArrayList(maxNumRouters);
     86        for (int i = 0; i < maxNumRouters; i++) {
     87            rv.add(sorted.remove(sorted.firstKey()));
     88        }
     89        return rv;
     90    }
     91   
    6792    private class FloodfillSelectionCollector implements SelectionCollector {
    68         private TreeMap _sorted;
    69         private List _floodfillMatches;
     93        private TreeMap<BigInteger, Hash> _sorted;
     94        private List<Hash> _floodfillMatches;
    7095        private Hash _key;
    71         private Set _toIgnore;
     96        private Set<Hash> _toIgnore;
    7297        private int _matches;
    7398        private int _wanted;
    74         public FloodfillSelectionCollector(Hash key, Set toIgnore, int wanted) {
     99        public FloodfillSelectionCollector(Hash key, Set<Hash> toIgnore, int wanted) {
    75100            _key = key;
    76101            _sorted = new TreeMap();
    77             _floodfillMatches = new ArrayList(1);
     102            _floodfillMatches = new ArrayList(8);
    78103            _toIgnore = toIgnore;
    79104            _matches = 0;
    80105            _wanted = wanted;
    81106        }
    82         public List getFloodfillParticipants() { return _floodfillMatches; }
     107        public List<Hash> getFloodfillParticipants() { return _floodfillMatches; }
    83108        private static final int EXTRA_MATCHES = 100;
    84109        public void add(Hash entry) {
     
    116141        }
    117142        /** get the first $howMany entries matching */
    118         public List get(int howMany) {
     143        public List<Hash> get(int howMany) {
    119144            return get(howMany, false);
    120145        }
    121146
    122         public List get(int howMany, boolean preferConnected) {
     147        public List<Hash> get(int howMany, boolean preferConnected) {
    123148            Collections.shuffle(_floodfillMatches, _context.random());
    124             List rv = new ArrayList(howMany);
    125             List badff = new ArrayList(howMany);
    126             List unconnectedff = new ArrayList(howMany);
     149            List<Hash> rv = new ArrayList(howMany);
     150            List<Hash> badff = new ArrayList(howMany);
     151            List<Hash> unconnectedff = new ArrayList(howMany);
    127152            int found = 0;
    128153            long now = _context.clock().now();
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillStoreJob.java

    r9c2c90c r5b4be5b  
    1818import net.i2p.router.RouterContext;
    1919
     20/**
     21 *  This extends StoreJob to fire off a FloodfillVerifyStoreJob after success.
     22 *
     23 */
    2024class FloodfillStoreJob extends StoreJob {   
    2125    private FloodfillNetworkDatabaseFacade _facade;
    2226    /**
    23      * Create a new search for the routingKey specified
     27     * Send a data structure to the floodfills
    2428     *
    2529     */
     
    3236     *               already know they have it).  This can be null.
    3337     */
    34     public FloodfillStoreJob(RouterContext context, FloodfillNetworkDatabaseFacade facade, Hash key, DataStructure data, Job onSuccess, Job onFailure, long timeoutMs, Set toSkip) {
     38    public FloodfillStoreJob(RouterContext context, FloodfillNetworkDatabaseFacade facade, Hash key, DataStructure data, Job onSuccess, Job onFailure, long timeoutMs, Set<Hash> toSkip) {
    3539        super(context, facade, key, data, onSuccess, onFailure, timeoutMs, toSkip);
    3640        _facade = facade;
  • router/java/src/net/i2p/router/networkdb/kademlia/PeerSelector.java

    r9c2c90c r5b4be5b  
    4444     */
    4545    /* FIXME Exporting non-public type through public API FIXME */
    46     public List selectMostReliablePeers(Hash key, int numClosest, Set alreadyChecked, KBucketSet kbuckets) {// LINT -- Exporting non-public type through public API
     46    public List<Hash> selectMostReliablePeers(Hash key, int numClosest, Set<Hash> alreadyChecked, KBucketSet kbuckets) {// LINT -- Exporting non-public type through public API
    4747        // get the peers closest to the key
    48         List nearest = selectNearestExplicit(key, numClosest, alreadyChecked, kbuckets);
    49         return nearest;
     48        return selectNearestExplicit(key, numClosest, alreadyChecked, kbuckets);
    5049    }
    5150   
     
    5857     */
    5958    /* FIXME Exporting non-public type through public API FIXME */
    60     public List selectNearestExplicit(Hash key, int maxNumRouters, Set peersToIgnore, KBucketSet kbuckets) {// LINT -- Exporting non-public type through public API
    61         if (true)
     59    public List<Hash> selectNearestExplicit(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet kbuckets) {// LINT -- Exporting non-public type through public API
     60        //if (true)
    6261            return selectNearestExplicitThin(key, maxNumRouters, peersToIgnore, kbuckets);
    6362       
     63/******
    6464        if (peersToIgnore == null)
    6565            peersToIgnore = new HashSet(1);
     
    8585                       + allHashes.size() + "]");
    8686        return peerHashes;
     87******/
    8788    }
    8889   
     
    9596     */
    9697    /* FIXME Exporting non-public type through public API FIXME */
    97     public List selectNearestExplicitThin(Hash key, int maxNumRouters, Set peersToIgnore, KBucketSet kbuckets) { // LINT -- Exporting non-public type through public API
     98    public List<Hash> selectNearestExplicitThin(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet kbuckets) { // LINT -- Exporting non-public type through public API
    9899        if (peersToIgnore == null)
    99100            peersToIgnore = new HashSet(1);
     
    110111   
    111112    private class MatchSelectionCollector implements SelectionCollector {
    112         private TreeMap _sorted;
     113        private TreeMap<BigInteger, Hash> _sorted;
    113114        private Hash _key;
    114         private Set _toIgnore;
     115        private Set<Hash> _toIgnore;
    115116        private int _matches;
    116         public MatchSelectionCollector(Hash key, Set toIgnore) {
     117        public MatchSelectionCollector(Hash key, Set<Hash> toIgnore) {
    117118            _key = key;
    118119            _sorted = new TreeMap();
     
    136137        }
    137138        /** get the first $howMany entries matching */
    138         public List get(int howMany) {
    139             List rv = new ArrayList(howMany);
     139        public List<Hash> get(int howMany) {
     140            List<Hash> rv = new ArrayList(howMany);
    140141            for (int i = 0; i < howMany; i++) {
    141142                if (_sorted.size() <= 0)
     
    152153     *
    153154     */
     155/********
    154156    private void removeFailingPeers(Set peerHashes) {
    155157        List failing = null;
     
    185187            peerHashes.removeAll(failing);
    186188    }
     189**********/
    187190   
    188191    public static BigInteger getDistance(Hash targetKey, Hash routerInQuestion) {
     
    200203     */
    201204    /* FIXME Exporting non-public type through public API FIXME */
    202     public List selectNearest(Hash key, int maxNumRouters, Set peersToIgnore, KBucketSet kbuckets) { // LINT -- Exporting non-public type through public API
     205    public List<Hash> selectNearest(Hash key, int maxNumRouters, Set<Hash> peersToIgnore, KBucketSet kbuckets) { // LINT -- Exporting non-public type through public API
    203206        // sure, this may not be exactly correct per kademlia (peers on the border of a kbucket in strict kademlia
    204207        // would behave differently) but I can see no reason to keep around an /additional/ more complicated algorithm.
  • router/java/src/net/i2p/router/networkdb/kademlia/StoreJob.java

    r9c2c90c r5b4be5b  
    5757   
    5858    /**
    59      * Create a new search for the routingKey specified
     59     * Send a data structure to the floodfills
    6060     *
    6161     */
     
    7070     */
    7171    public StoreJob(RouterContext context, KademliaNetworkDatabaseFacade facade, Hash key,
    72                     DataStructure data, Job onSuccess, Job onFailure, long timeoutMs, Set toSkip) {
     72                    DataStructure data, Job onSuccess, Job onFailure, long timeoutMs, Set<Hash> toSkip) {
    7373        super(context);
    7474        _log = context.logManager().getLog(StoreJob.class);
     
    147147        // the network to scale.
    148148        // Perhaps the ultimate solution is to send RouterInfos through a lease also.
    149         List closestHashes;
     149        List<Hash> closestHashes;
    150150        if (_state.getData() instanceof RouterInfo)
    151151            closestHashes = getMostReliableRouters(_state.getTarget(), toCheck, _state.getAttempted());
     
    166166            if (_log.shouldLog(Log.INFO))
    167167                _log.info(getJobId() + ": Continue sending key " + _state.getTarget() + " after " + _state.getAttempted().size() + " tries to " + closestHashes);
    168             for (Iterator iter = closestHashes.iterator(); iter.hasNext(); ) {
    169                 Hash peer = (Hash)iter.next();
     168            for (Iterator<Hash> iter = closestHashes.iterator(); iter.hasNext(); ) {
     169                Hash peer = iter.next();
    170170                DataStructure ds = _facade.getDataStore().get(peer);
    171171                if ( (ds == null) || !(ds instanceof RouterInfo) ) {
     
    216216     * @return ordered list of Hash objects
    217217     */
    218     private List getClosestRouters(Hash key, int numClosest, Set alreadyChecked) {
     218    private List<Hash> getClosestRouters(Hash key, int numClosest, Set<Hash> alreadyChecked) {
    219219        Hash rkey = getContext().routingKeyGenerator().getRoutingKey(key);
    220220        //if (_log.shouldLog(Log.DEBUG))
     
    226226    }
    227227
    228     private List getMostReliableRouters(Hash key, int numClosest, Set alreadyChecked) {
     228    private List<Hash> getMostReliableRouters(Hash key, int numClosest, Set<Hash> alreadyChecked) {
    229229        Hash rkey = getContext().routingKeyGenerator().getRoutingKey(key);
    230230        KBucketSet ks = _facade.getKBuckets();
  • router/java/src/net/i2p/router/networkdb/kademlia/StoreState.java

    r9c2c90c r5b4be5b  
    1616    private Hash _key;
    1717    private DataStructure _data;
    18     private final HashSet _pendingPeers;
    19     private HashMap _pendingPeerTimes;
    20     private final HashSet _successfulPeers;
    21     private final HashSet _successfulExploratoryPeers;
    22     private final HashSet _failedPeers;
    23     private final HashSet _attemptedPeers;
     18    private final HashSet<Hash> _pendingPeers;
     19    private HashMap<Hash, Long> _pendingPeerTimes;
     20    private final HashSet<Hash> _successfulPeers;
     21    private final HashSet<Hash> _successfulExploratoryPeers;
     22    private final HashSet<Hash> _failedPeers;
     23    private final HashSet<Hash> _attemptedPeers;
    2424    private int _completeCount;
    2525    private volatile long _completed;
     
    2929        this(ctx, key, data, null);
    3030    }
    31     public StoreState(RouterContext ctx, Hash key, DataStructure data, Set toSkip) {
     31    public StoreState(RouterContext ctx, Hash key, DataStructure data, Set<Hash> toSkip) {
    3232        _context = ctx;
    3333        _key = key;
     
    4949    public Hash getTarget() { return _key; }
    5050    public DataStructure getData() { return _data; }
    51     public Set getPending() {
    52         synchronized (_pendingPeers) {
    53             return (Set)_pendingPeers.clone();
    54         }
    55     }
    56     public Set getAttempted() {
    57         synchronized (_attemptedPeers) {
    58             return (Set)_attemptedPeers.clone();
    59         }
    60     }
    61     public Set getSuccessful() {
     51    public Set<Hash> getPending() {
     52        synchronized (_pendingPeers) {
     53            return (Set<Hash>)_pendingPeers.clone();
     54        }
     55    }
     56    public Set<Hash> getAttempted() {
     57        synchronized (_attemptedPeers) {
     58            return (Set<Hash>)_attemptedPeers.clone();
     59        }
     60    }
     61    public Set<Hash> getSuccessful() {
    6262        synchronized (_successfulPeers) {
    63             return (Set)_successfulPeers.clone();
    64         }
    65     }
    66     public Set getSuccessfulExploratory() {
     63            return (Set<Hash>)_successfulPeers.clone();
     64        }
     65    }
     66    public Set<Hash> getSuccessfulExploratory() {
    6767        synchronized (_successfulExploratoryPeers) {
    68             return (Set)_successfulExploratoryPeers.clone();
    69         }
    70     }
    71     public Set getFailed() {
     68            return (Set<Hash>)_successfulExploratoryPeers.clone();
     69        }
     70    }
     71    public Set<Hash> getFailed() {
    7272        synchronized (_failedPeers) {
    73             return (Set)_failedPeers.clone();
     73            return (Set<Hash>)_failedPeers.clone();
    7474        }
    7575    }
     
    9393        }
    9494    }
    95     public void addPending(Collection pending) {
     95    public void addPending(Collection<Hash> pending) {
    9696        synchronized (_pendingPeers) {
    9797            _pendingPeers.addAll(pending);
    98             for (Iterator iter = pending.iterator(); iter.hasNext(); )
     98            for (Iterator<Hash> iter = pending.iterator(); iter.hasNext(); )
    9999                _pendingPeerTimes.put(iter.next(), new Long(_context.clock().now()));
    100100        }
     
    114114        synchronized (_pendingPeers) {
    115115            _pendingPeers.remove(peer);
    116             Long when = (Long)_pendingPeerTimes.remove(peer);
     116            Long when = _pendingPeerTimes.remove(peer);
    117117            if (when != null)
    118118                rv = _context.clock().now() - when.longValue();
     
    129129        synchronized (_pendingPeers) {
    130130            _pendingPeers.remove(peer);
    131             Long when = (Long)_pendingPeerTimes.remove(peer);
     131            Long when = _pendingPeerTimes.remove(peer);
    132132            if (when != null)
    133133                rv = _context.clock().now() - when.longValue();
     
    160160        synchronized (_attemptedPeers) {
    161161            buf.append(_attemptedPeers.size()).append(' ');
    162             for (Iterator iter = _attemptedPeers.iterator(); iter.hasNext(); ) {
    163                 Hash peer = (Hash)iter.next();
     162            for (Iterator<Hash> iter = _attemptedPeers.iterator(); iter.hasNext(); ) {
     163                Hash peer = iter.next();
    164164                buf.append(peer.toBase64()).append(" ");
    165165            }
     
    168168        synchronized (_pendingPeers) {
    169169            buf.append(_pendingPeers.size()).append(' ');
    170             for (Iterator iter = _pendingPeers.iterator(); iter.hasNext(); ) {
    171                 Hash peer = (Hash)iter.next();
     170            for (Iterator<Hash> iter = _pendingPeers.iterator(); iter.hasNext(); ) {
     171                Hash peer = iter.next();
    172172                buf.append(peer.toBase64()).append(" ");
    173173            }
     
    176176        synchronized (_failedPeers) {
    177177            buf.append(_failedPeers.size()).append(' ');
    178             for (Iterator iter = _failedPeers.iterator(); iter.hasNext(); ) {
    179                 Hash peer = (Hash)iter.next();
     178            for (Iterator<Hash> iter = _failedPeers.iterator(); iter.hasNext(); ) {
     179                Hash peer = iter.next();
    180180                buf.append(peer.toBase64()).append(" ");
    181181            }
     
    184184        synchronized (_successfulPeers) {
    185185            buf.append(_successfulPeers.size()).append(' ');
    186             for (Iterator iter = _successfulPeers.iterator(); iter.hasNext(); ) {
    187                 Hash peer = (Hash)iter.next();
     186            for (Iterator<Hash> iter = _successfulPeers.iterator(); iter.hasNext(); ) {
     187                Hash peer = iter.next();
    188188                buf.append(peer.toBase64()).append(" ");
    189189            }
     
    192192        synchronized (_successfulExploratoryPeers) {
    193193            buf.append(_successfulExploratoryPeers.size()).append(' ');
    194             for (Iterator iter = _successfulExploratoryPeers.iterator(); iter.hasNext(); ) {
    195                 Hash peer = (Hash)iter.next();
     194            for (Iterator<Hash> iter = _successfulExploratoryPeers.iterator(); iter.hasNext(); ) {
     195                Hash peer = iter.next();
    196196                buf.append(peer.toBase64()).append(" ");
    197197            }
  • router/java/src/net/i2p/router/peermanager/PeerManager.java

    r9c2c90c r5b4be5b  
    251251        }
    252252    }
    253 
    254     public void renderStatusHTML(Writer out) throws IOException {
    255         _organizer.renderStatusHTML(out);
    256     }
    257253}
  • router/java/src/net/i2p/router/peermanager/PeerManagerFacadeImpl.java

    r9c2c90c r5b4be5b  
    7979    }
    8080
     81    /** @deprecated, moved to routerconsole */
    8182    public void renderStatusHTML(Writer out) throws IOException {
    82         _manager.renderStatusHTML(out);
    8383    }
    8484   
  • router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java

    r9c2c90c r5b4be5b  
    140140
    141141    public void setUs(Hash us) { _us = us; }
    142     Hash getUs() { return _us; }
     142    public Hash getUs() { return _us; }
    143143   
    144144    public double getSpeedThreshold() { return _thresholdSpeedValue; }
     
    257257        if (prof != null)
    258258            _persistenceHelper.writeProfile(prof, out);
    259     }
    260    
    261     public void renderStatusHTML(Writer out) throws IOException {
    262         ProfileOrganizerRenderer rend = new ProfileOrganizerRenderer(this, _context);
    263         rend.renderStatusHTML(out);
    264259    }
    265260   
Note: See TracChangeset for help on using the changeset viewer.