Changeset 536f5d0


Ignore:
Timestamp:
Sep 6, 2008 1:48:57 PM (13 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
1091a28
Parents:
a3108ea
Message:
  • Shitlist: Fix partial shitlisting (still unused though)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/Shitlist.java

    ra3108ea r536f5d0  
    4848    public final static long SHITLIST_DURATION_MS = 40*60*1000; // 40 minute shitlist
    4949    public final static long SHITLIST_DURATION_MAX = 60*60*1000;
     50    public final static long SHITLIST_DURATION_PARTIAL = 20*60*1000;
    5051    public final static long SHITLIST_DURATION_FOREVER = 181l*24*60*60*1000; // will get rounded down to 180d on console
    5152   
     
    102103    public boolean shitlistRouter(Hash peer, String reason) { return shitlistRouter(peer, reason, null); }
    103104    public boolean shitlistRouter(Hash peer, String reason, String transport) {
    104         return shitlistRouter(peer, reason, null, false);
     105        return shitlistRouter(peer, reason, transport, false);
    105106    }
    106107    public boolean shitlistRouterForever(Hash peer, String reason) {
     
    118119        boolean wasAlready = false;
    119120        if (_log.shouldLog(Log.INFO))
    120             _log.info("Shitlisting router " + peer.toBase64(), new Exception("Shitlist cause: " + reason));
     121            _log.info("Shitlisting router " + peer.toBase64() +
     122               ((transport != null) ? " on transport " + transport : ""), new Exception("Shitlist cause: " + reason));
    121123       
    122124        Entry e = new Entry();
    123125        if (forever) {
    124126            e.expireOn = _context.clock().now() + SHITLIST_DURATION_FOREVER;
     127        else if (transport != null) {
     128            e.expireOn = _context.clock().now() + SHITLIST_DURATION_PARTIAL;
    125129        } else {
    126130            long period = SHITLIST_DURATION_MS + _context.random().nextLong(SHITLIST_DURATION_MS);
     
    154158                    if (old.transports != null)
    155159                        e.transports.addAll(old.transports);
    156                     else  
     160                    else {
    157161                        e.transports = null;
     162                        e.cause = reason;
     163                    }
    158164                }
    159165            }
     
    271277        buf.append("<ul>");
    272278       
    273         int partial = 0;
    274279        for (Iterator iter = entries.keySet().iterator(); iter.hasNext(); ) {
    275280            Hash key = (Hash)iter.next();
    276281            Entry entry = (Entry)entries.get(key);
    277             if ( (entry.transports != null) && (entry.transports.size() > 0) ) {
    278                 partial++;
    279                 continue;
    280             }
    281282            buf.append("<li><b>").append(key.toBase64()).append("</b>");
    282283            buf.append(" (<a href=\"netdb.jsp#").append(key.toBase64().substring(0, 6)).append("\">netdb</a>)");
     
    285286            Set transports = entry.transports;
    286287            if ( (transports != null) && (transports.size() > 0) )
    287                 buf.append(" on the following transports: ").append(transports);
     288                buf.append(" on the following transport: ").append(transports);
    288289            if (entry.cause != null) {
    289290                buf.append("<br />\n");
     
    294295        }
    295296        buf.append("</ul>\n");
    296         if (partial > 0) {
    297             buf.append("<i>Partial shitlisted peers (only blocked on some transports): ");
    298             buf.append(partial);
    299             buf.append("</i>\n");
    300         }
    301297        out.write(buf.toString());
    302298        out.flush();
Note: See TracChangeset for help on using the changeset viewer.