Changeset 9234a94


Ignore:
Timestamp:
May 17, 2009 12:20:34 PM (11 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
9a6a993a
Parents:
87eafa3 (diff), 287eff5 (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:

propagate from branch 'i2p.i2p.zzz.test' (head f402c08d0b2796653b559711cb1ea8c3c0204372)

to branch 'i2p.i2p' (head 4d0babb75e3c5237b10ff49f57599c53c581bb83)

Files:
1 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • LICENSE.txt

    r87eafa3 r9234a94  
    122122   See licenses/LICENSE-Apache1.1.txt
    123123   See licenses/LICENSE-Apache2.0.txt
    124    See licenses/NOTICE-Ant.txt
    125124   See licenses/NOTICE-Commons-Logging.txt
    126125
  • apps/i2ptunnel/java/build.xml

    r87eafa3 r9234a94  
    5656        <mkdir dir="../jsp/WEB-INF/classes" />
    5757        <!-- there are various jspc ant tasks, but they all seem a bit flakey -->
    58         <java classname="org.apache.jasper.JspC" fork="true" >
     58        <java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
    5959            <classpath>
    6060                <pathelement location="../../jetty/jettylib/jasper-compiler.jar" />
  • apps/routerconsole/java/build.xml

    r87eafa3 r9234a94  
    8787        <mkdir dir="../jsp/WEB-INF/classes" />
    8888        <!-- there are various jspc ant tasks, but they all seem a bit flakey -->
    89         <java classname="org.apache.jasper.JspC" fork="true">
     89        <java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
    9090            <classpath>
    9191                <pathelement location="../../jetty/jettylib/jasper-compiler.jar" />
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigTunnelsHelper.java

    r87eafa3 r9234a94  
    6464            out.getLength() + out.getLengthVariance() <= 0)
    6565            buf.append("<tr><td colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 0-hop tunnels</font></td></tr>");
     66        else if (in.getLength() <= 1 ||
     67            in.getLength() + in.getLengthVariance() <= 1 ||
     68            out.getLength() <= 1 ||
     69            out.getLength() + out.getLengthVariance() <= 1)
     70            buf.append("<tr><td colspan=\"3\"><font color=\"red\">ANONYMITY WARNING - Settings include 1-hop tunnels</font></td></tr>");
    6671        if (in.getLength() + Math.abs(in.getLengthVariance()) >= WARN_LENGTH ||
    6772            out.getLength() + Math.abs(out.getLengthVariance()) >= WARN_LENGTH)
  • apps/routerconsole/jsp/logs.jsp

    r87eafa3 r9234a94  
    2727 <jsp:getProperty name="logsHelper" property="criticalLogs" />
    2828 <hr />
    29  <h4>Router logs:</h4>
     29 <h4>Router logs (<a href="configlogging.jsp">configure</a>):</h4>
    3030 <jsp:getProperty name="logsHelper" property="logs" />
    3131 <hr />
  • apps/susidns/src/build.xml

    r87eafa3 r9234a94  
    3636        <mkdir dir="${tmp}" />
    3737        <echo message="Ignore any warning about /WEB-INF/web.xml not found" />
    38         <java classname="org.apache.jasper.JspC" fork="true" classpathref="cp">
     38        <java classname="org.apache.jasper.JspC" fork="true" classpathref="cp" failonerror="true">
    3939            <arg value="-d" />
    4040            <arg value="${tmp}" />
  • apps/susidns/src/java/src/i2p/susi/dns/AddressbookBean.java

    r87eafa3 r9234a94  
    3838{
    3939        private String book, action, serial, lastSerial, filter, search, hostname, destination;
     40        private int beginIndex, endIndex;
    4041        private Properties properties, addressbook;
    4142        private int trClass;
    4243        private LinkedList deletionMarks;
    4344        private static Comparator sorter;
    44        
     45        private static final int DISPLAY_SIZE=100;
     46
    4547        static {
    4648                sorter = new AddressByNameSorter();
     
    7577                properties = new Properties();
    7678                deletionMarks = new LinkedList();
     79                beginIndex = 0;
     80                endIndex = DISPLAY_SIZE - 1;
    7781        }
    7882        private long configLastLoaded = 0;
     
    107111                loadConfig();
    108112                String filename = properties.getProperty( getBook() + "_addressbook" );
     113                if (filename.startsWith("../"))
     114                        return filename.substring(3);
    109115                return ConfigBean.addressbookPrefix + filename;
    110116        }
     
    175181                                list.addLast( new AddressBean( name, destination ) );
    176182                        }
    177                         // Format a message about filtered addressbook size, and the number of displayed entries
    178                         if( filter != null && filter.length() > 0 )
    179                                 message = "Filtered l";
    180                         else
    181                                 message = "L";
    182                         message += "ist contains " + list.size() + " entries";
    183                         if (list.size() > 300) message += ", displaying the first 300."; else message += ".";
    184 
    185183                        Object array[] = list.toArray();
    186184                        Arrays.sort( array, sorter );
    187185                        entries = array;
     186
     187                        // Format a message about filtered addressbook size, and the number of displayed entries
     188                        // addressbook.jsp catches the case where the whole book is empty.
     189                        String filterArg = "";
     190                        if( search != null && search.length() > 0 ) {
     191                                message = "Search ";
     192                        }
     193                        if( filter != null && filter.length() > 0 ) {
     194                                if( search != null && search.length() > 0 )
     195                                        message += "within ";
     196                                message += "Filtered list ";
     197                                filterArg = "&filter=" + filter;
     198                        }
     199                        if (entries.length == 0) {
     200                                message += "- no matches";
     201                        } else if (getBeginInt() == 0 && getEndInt() == entries.length - 1) {
     202                                if (message.length() == 0)
     203                                        message = "Addressbook ";
     204                                message += "contains " + entries.length + " entries";
     205                        } else {
     206                                if (getBeginInt() > 0) {
     207                                        int newBegin = Math.max(0, getBeginInt() - DISPLAY_SIZE);
     208                                        int newEnd = Math.max(0, getBeginInt() - 1);
     209                                        message += "<a href=\"addressbook.jsp?book=" + getBook() + filterArg +
     210                                                   "&begin=" + newBegin + "&end=" + newEnd + "\">" + newBegin +
     211                                                   '-' + newEnd + "</a> | ";
     212                                }
     213                                message += "Showing " + getBegin() + '-' + getEnd() + " of " + entries.length;
     214                                if (getEndInt() < entries.length - 1) {
     215                                        int newBegin = Math.min(entries.length - 1, getEndInt() + 1);
     216                                        int newEnd = Math.min(entries.length, getEndInt() + DISPLAY_SIZE);
     217                                        message += " | <a href=\"addressbook.jsp?book=" + getBook() + filterArg +
     218                                                   "&begin=" + newBegin + "&end=" + newEnd + "\">" + newBegin +
     219                                                   '-' + newEnd + "</a>";
     220                                }
     221                        }
    188222                }
    189223                catch (Exception e) {
     
    303337                this.hostname = hostname;
    304338        }
     339        private int getBeginInt() {
     340                return Math.max(0, Math.min(entries.length - 1, beginIndex));
     341        }
     342        public String getBegin() {
     343                return "" + getBeginInt();
     344        }
     345        public void setBegin(String s) {
     346                try {
     347                        beginIndex = Integer.parseInt(s);
     348                } catch (NumberFormatException nfe) {}
     349        }
     350        private int getEndInt() {
     351                return Math.max(0, Math.max(getBeginInt(), Math.min(entries.length - 1, endIndex)));
     352        }
     353        public String getEnd() {
     354                return "" + getEndInt();
     355        }
     356        public void setEnd(String s) {
     357                try {
     358                        endIndex = Integer.parseInt(s);
     359                } catch (NumberFormatException nfe) {}
     360        }
    305361}
  • apps/susidns/src/jsp/addressbook.jsp

    r87eafa3 r9234a94  
    4747<div id="navi">
    4848<p>addressbooks
    49 <a href="addressbook.jsp?book=master">master</a> |
    50 <a href="addressbook.jsp?book=router">router</a> |
    51 <a href="addressbook.jsp?book=published">published</a> |
    52 <a href="addressbook.jsp?book=private">private</a> *
     49<a href="addressbook.jsp?book=master&filter=none&begin=0&end=99">master</a> |
     50<a href="addressbook.jsp?book=router&filter=none&begin=0&end=99">router</a> |
     51<a href="addressbook.jsp?book=published&filter=none&begin=0&end=99">published</a> |
     52<a href="addressbook.jsp?book=private&filter=none&begin=0&end=99">private</a> *
    5353<a href="subscriptions.jsp">subscriptions</a> *
    5454<a href="config.jsp">configuration</a> *
     
    6565<span>${book.loadBookMessages}</span>
    6666
     67<c:if test="${book.notEmpty}">
    6768<div id="filter">
    68 <p>Filter: <a href="addressbook.jsp?filter=a">a</a>
    69 <a href="addressbook.jsp?filter=b">b</a>
    70 <a href="addressbook.jsp?filter=c">c</a>
    71 <a href="addressbook.jsp?filter=d">d</a>
    72 <a href="addressbook.jsp?filter=e">e</a>
    73 <a href="addressbook.jsp?filter=f">f</a>
    74 <a href="addressbook.jsp?filter=g">g</a>
    75 <a href="addressbook.jsp?filter=h">h</a>
    76 <a href="addressbook.jsp?filter=i">i</a>
    77 <a href="addressbook.jsp?filter=j">j</a>
    78 <a href="addressbook.jsp?filter=k">k</a>
    79 <a href="addressbook.jsp?filter=l">l</a>
    80 <a href="addressbook.jsp?filter=m">m</a>
    81 <a href="addressbook.jsp?filter=n">n</a>
    82 <a href="addressbook.jsp?filter=o">o</a>
    83 <a href="addressbook.jsp?filter=p">p</a>
    84 <a href="addressbook.jsp?filter=q">q</a>
    85 <a href="addressbook.jsp?filter=r">r</a>
    86 <a href="addressbook.jsp?filter=s">s</a>
    87 <a href="addressbook.jsp?filter=t">t</a>
    88 <a href="addressbook.jsp?filter=u">u</a>
    89 <a href="addressbook.jsp?filter=v">v</a>
    90 <a href="addressbook.jsp?filter=w">w</a>
    91 <a href="addressbook.jsp?filter=x">x</a>
    92 <a href="addressbook.jsp?filter=y">y</a>
    93 <a href="addressbook.jsp?filter=z">z</a>
    94 <a href="addressbook.jsp?filter=0-9">0-9</a>
    95 <a href="addressbook.jsp?filter=none">all</a></p>
     69<p>Filter:
     70<a href="addressbook.jsp?filter=a&begin=0&end=99">a</a>
     71<a href="addressbook.jsp?filter=b&begin=0&end=99">b</a>
     72<a href="addressbook.jsp?filter=c&begin=0&end=99">c</a>
     73<a href="addressbook.jsp?filter=d&begin=0&end=99">d</a>
     74<a href="addressbook.jsp?filter=e&begin=0&end=99">e</a>
     75<a href="addressbook.jsp?filter=f&begin=0&end=99">f</a>
     76<a href="addressbook.jsp?filter=g&begin=0&end=99">g</a>
     77<a href="addressbook.jsp?filter=h&begin=0&end=99">h</a>
     78<a href="addressbook.jsp?filter=i&begin=0&end=99">i</a>
     79<a href="addressbook.jsp?filter=j&begin=0&end=99">j</a>
     80<a href="addressbook.jsp?filter=k&begin=0&end=99">k</a>
     81<a href="addressbook.jsp?filter=l&begin=0&end=99">l</a>
     82<a href="addressbook.jsp?filter=m&begin=0&end=99">m</a>
     83<a href="addressbook.jsp?filter=n&begin=0&end=99">n</a>
     84<a href="addressbook.jsp?filter=o&begin=0&end=99">o</a>
     85<a href="addressbook.jsp?filter=p&begin=0&end=99">p</a>
     86<a href="addressbook.jsp?filter=q&begin=0&end=99">q</a>
     87<a href="addressbook.jsp?filter=r&begin=0&end=99">r</a>
     88<a href="addressbook.jsp?filter=s&begin=0&end=99">s</a>
     89<a href="addressbook.jsp?filter=t&begin=0&end=99">t</a>
     90<a href="addressbook.jsp?filter=u&begin=0&end=99">u</a>
     91<a href="addressbook.jsp?filter=v&begin=0&end=99">v</a>
     92<a href="addressbook.jsp?filter=w&begin=0&end=99">w</a>
     93<a href="addressbook.jsp?filter=x&begin=0&end=99">x</a>
     94<a href="addressbook.jsp?filter=y&begin=0&end=99">y</a>
     95<a href="addressbook.jsp?filter=z&begin=0&end=99">z</a>
     96<a href="addressbook.jsp?filter=0-9&begin=0&end=99">0-9</a>
     97<a href="addressbook.jsp?filter=none&begin=0&end=99">all</a></p>
    9698<c:if test="${book.hasFilter}">
    9799<p>Current filter: ${book.filter}
    98 (<a href="addressbook.jsp?filter=none">clear filter</a>)</p>
     100(<a href="addressbook.jsp?filter=none&begin=0&end=99">clear filter</a>)</p>
    99101</c:if>
    100102</div>
    101103
    102104<form method="POST" action="addressbook.jsp">
     105<input type="hidden" name="begin" value="0"/>
     106<input type="hidden" name="end" value="99"/>
    103107<div id="search">
    104108<table><tr>
     
    110114
    111115</form>
     116</c:if>
    112117
    113118<form method="POST" action="addressbook.jsp">
    114119<input type="hidden" name="serial" value="${book.serial}"/>
     120<input type="hidden" name="begin" value="0"/>
     121<input type="hidden" name="end" value="99"/>
    115122
    116123<c:if test="${book.notEmpty}">
     
    128135<th>Destination</th>
    129136</tr>
    130 <!-- limit iterator to 300, or "Form too large" may result on submit -->
    131 <c:forEach items="${book.entries}" var="addr" begin="0" end="299">
     137<!-- limit iterator, or "Form too large" may result on submit, and is a huge web page if we don't -->
     138<c:forEach items="${book.entries}" var="addr" begin="${book.begin}" end="${book.end}">
    132139<tr class="list${book.trClass}">
    133140<c:if test="${book.master || book.router || book.published || book.private}">
     
    137144<span class="addrhlpr"><a href="http://${addr.name}/?i2paddresshelper=${addr.destination}">(addrhlpr)</a></span>
    138145</td>
    139 <td class="destinations"><textarea rows="1" cols="20" wrap="off" readonly="readonly" name="dest_${addr.name}" >${addr.destination}</textarea></td>
     146<td class="destinations"><textarea rows="1" cols="40" wrap="off" readonly="readonly" name="dest_${addr.name}" >${addr.destination}</textarea></td>
    140147</tr>
    141148</c:forEach>
     
    161168<p class="add">
    162169<h3>Add new destination:</h3>
    163 Hostname: <input type="text" name="hostname" value="${book.hostname}" size="20">
    164 Destination: <textarea name="destination" rows="1" cols="20" wrap="off" >${book.destination}</textarea><br/>
     170<b>Hostname:</b> <input type="text" name="hostname" value="${book.hostname}" size="20">
     171<b>Destination:</b> <textarea name="destination" rows="1" cols="40" wrap="off" >${book.destination}</textarea><br/>
     172</p><p>
    165173<input type="image" name="action" value="add" src="images/add.png" alt="Add destination" />
    166174</p>
  • build.xml

    r87eafa3 r9234a94  
    7373        <copy file="apps/routerconsole/java/build/routerconsole.war" todir="build/" />
    7474        <copy file="apps/jetty/jettylib/org.mortbay.jetty.jar" todir="build/" />
    75         <copy file="apps/jetty/jettylib/ant.jar" todir="build/" />
    7675        <copy file="apps/jetty/jettylib/jasper-compiler.jar" todir="build/" />
    7776        <copy file="apps/jetty/jettylib/jasper-runtime.jar" todir="build/" />
     
    104103            <manifest>
    105104             <attribute name="Main-Class" value="net.i2p.router.RouterLaunch" />
    106              <attribute name="Class-Path" value="lib/i2p.jar lib/router.jar lib/jbigi.jar lib/BOB.jar lib/sam.jar lib/mstreaming.jar lib/streaming.jar lib/routerconsole.jar lib/i2ptunnel.jar lib/org.mortbay.jetty.jar lib/javax.servlet.jar lib/jasper-compiler.jar lib/jasper-runtime.jar lib/commons-logging.jar lib/commons-el.jar lib/ant.jar lib/wrapper.jar lib/systray.jar lib/systray4j.jar" />
     105             <attribute name="Class-Path" value="lib/i2p.jar lib/router.jar lib/jbigi.jar lib/BOB.jar lib/sam.jar lib/mstreaming.jar lib/streaming.jar lib/routerconsole.jar lib/i2ptunnel.jar lib/org.mortbay.jetty.jar lib/javax.servlet.jar lib/jasper-compiler.jar lib/jasper-runtime.jar lib/commons-logging.jar lib/commons-el.jar lib/wrapper.jar lib/systray.jar lib/systray4j.jar" />
    107106            </manifest>
    108107        </jar>
     
    211210    <target name="preppkg" depends="build, buildexe">
    212211        <delete dir="pkg-temp" />
    213         <copy file="build/ant.jar" todir="pkg-temp/lib/" />
    214212        <copy file="build/i2p.jar" todir="pkg-temp/lib/" />
    215213        <copy file="build/i2ptunnel.jar" todir="pkg-temp/lib/" />
     
    397395    </target>
    398396    <target name="prepjupdate" depends="prepupdate, buildWEB">
    399         <copy file="build/ant.jar" todir="pkg-temp/lib/" />
    400397        <copy file="build/jasper-compiler.jar" todir="pkg-temp/lib/" />
    401398        <copy file="build/jasper-runtime.jar" todir="pkg-temp/lib/" />
     
    492489            <arg value="findbugs.xml"/>
    493490            <arg value="-auxclasspath"/>
    494             <arg value="build/ant.jar:build/commons-el.jar:build/commons-logging.jar:build/jasper-compiler.jar:build/jasper-runtime.jar:build/javax.servlet.jar:build/org.mortbay.jetty.jar:apps/jrobin/jrobin-1.4.0.jar:apps/systray/java/lib/systray4j.jar:installer/lib/wrapper/linux/wrapper.jar"/>
     491            <arg value="build/commons-el.jar:build/commons-logging.jar:build/jasper-compiler.jar:build/jasper-runtime.jar:build/javax.servlet.jar:build/org.mortbay.jetty.jar:apps/jrobin/jrobin-1.4.0.jar:apps/systray/java/lib/systray4j.jar:installer/lib/wrapper/linux/wrapper.jar"/>
    495492            <arg value="-sourcepath"/>
    496493            <arg value="apps/BOB/src/:apps/addressbook/java/src/:apps/i2psnark/java/src/:apps/i2ptunnel/java/src/:apps/ministreaming/java/src/:apps/routerconsole/java/src/:apps/sam/java/src/:apps/streaming/java/src/:apps/susidns/src/java/src/:apps/susimail/src/src/:apps/systray/java/src/:core/java/src/:router/java/src/"/>
  • installer/resources/wrapper.config

    r87eafa3 r9234a94  
    4747wrapper.java.classpath.13=lib/commons-logging.jar
    4848wrapper.java.classpath.14=lib/commons-el.jar
    49 wrapper.java.classpath.15=lib/ant.jar
    5049# java service wrapper, BSD
    51 wrapper.java.classpath.16=lib/wrapper.jar
     50wrapper.java.classpath.15=lib/wrapper.jar
    5251# systray, LGPL
    53 wrapper.java.classpath.17=lib/systray.jar
    54 wrapper.java.classpath.18=lib/systray4j.jar
     52wrapper.java.classpath.16=lib/systray.jar
     53wrapper.java.classpath.17=lib/systray4j.jar
    5554# BOB
    56 wrapper.java.classpath.19=lib/BOB.jar
     55wrapper.java.classpath.18=lib/BOB.jar
    5756# desktopgui
    58 wrapper.java.classpath.20=lib/appframework.jar
    59 wrapper.java.classpath.21=lib/swing-worker.jar
    60 wrapper.java.classpath.22=lib/desktopgui.jar
     57wrapper.java.classpath.19=lib/appframework.jar
     58wrapper.java.classpath.20=lib/swing-worker.jar
     59wrapper.java.classpath.21=lib/desktopgui.jar
    6160
    6261# Java Library Path (location of Wrapper.DLL or libwrapper.so)
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillStoreJob.java

    r87eafa3 r9234a94  
    1313import net.i2p.data.DataStructure;
    1414import net.i2p.data.Hash;
     15import net.i2p.data.LeaseSet;
     16import net.i2p.data.RouterInfo;
    1517import net.i2p.router.Job;
    1618import net.i2p.router.RouterContext;
     
    4648    protected void succeed() {
    4749        super.succeed();
    48         if (_state != null)
    49             getContext().jobQueue().addJob(new FloodfillVerifyStoreJob(getContext(), _state.getTarget(), _facade));
     50        if (_state != null) {
     51            // Get the time stamp from the data we sent, so the Verify job can meke sure that
     52            // it finds something stamped with that time or newer.
     53            long published = 0;
     54            boolean isRouterInfo = false;
     55            DataStructure data = _state.getData();
     56            if (data instanceof RouterInfo) {
     57                published = ((RouterInfo) data).getPublished();
     58                isRouterInfo = true;
     59            } else if (data instanceof LeaseSet) {
     60                published = ((LeaseSet) data).getEarliestLeaseDate();
     61            }
     62            getContext().jobQueue().addJob(new FloodfillVerifyStoreJob(getContext(), _state.getTarget(),
     63                                                                       published, isRouterInfo, _facade));
     64        }
    5065    }
    5166   
  • router/java/src/net/i2p/router/networkdb/kademlia/FloodfillVerifyStoreJob.java

    r87eafa3 r9234a94  
    66import net.i2p.data.DataStructure;
    77import net.i2p.data.Hash;
     8import net.i2p.data.LeaseSet;
     9import net.i2p.data.RouterInfo;
    810import net.i2p.data.i2np.DatabaseLookupMessage;
    911import net.i2p.data.i2np.DatabaseSearchReplyMessage;
     
    3032    private long _expiration;
    3133    private long _sendTime;
     34    private long _published;
     35    private boolean _isRouterInfo;
    3236   
    3337    private static final int VERIFY_TIMEOUT = 10*1000;
    3438   
    35     public FloodfillVerifyStoreJob(RouterContext ctx, Hash key, FloodfillNetworkDatabaseFacade facade) {
     39    public FloodfillVerifyStoreJob(RouterContext ctx, Hash key, long published, boolean isRouterInfo, FloodfillNetworkDatabaseFacade facade) {
    3640        super(ctx);
    3741        _key = key;
     42        _published = published;
     43        _isRouterInfo = isRouterInfo;
    3844        _log = ctx.logManager().getLog(getClass());
    3945        _facade = facade;
    4046        // wait 10 seconds before trying to verify the store
    4147        getTiming().setStartAfter(ctx.clock().now() + VERIFY_TIMEOUT);
    42         getContext().statManager().createRateStat("netDb.floodfillVerifyOK", "How long a floodfill verify takes when it succeeds", "NetworkDatabase", new long[] { 60*1000, 10*60*1000, 60*60*1000 });
    43         getContext().statManager().createRateStat("netDb.floodfillVerifyFail", "How long a floodfill verify takes when it fails", "NetworkDatabase", new long[] { 60*1000, 10*60*1000, 60*60*1000 });
    44         getContext().statManager().createRateStat("netDb.floodfillVerifyTimeout", "How long a floodfill verify takes when it times out", "NetworkDatabase", new long[] { 60*1000, 10*60*1000, 60*60*1000 });
     48        getContext().statManager().createRateStat("netDb.floodfillVerifyOK", "How long a floodfill verify takes when it succeeds", "NetworkDatabase", new long[] { 60*60*1000 });
     49        getContext().statManager().createRateStat("netDb.floodfillVerifyFail", "How long a floodfill verify takes when it fails", "NetworkDatabase", new long[] { 60*60*1000 });
     50        getContext().statManager().createRateStat("netDb.floodfillVerifyTimeout", "How long a floodfill verify takes when it times out", "NetworkDatabase", new long[] { 60*60*1000 });
    4551    }
    4652    public String getName() { return "Verify netdb store"; }
     53
     54    /**
     55     *  Wait 10 seconds, then query a random floodfill for the leaseset or routerinfo
     56     *  that we just stored to a (hopefully different) floodfill peer.
     57     *
     58     *  If it fails (after waiting up to another 10 seconds), resend the data.
     59     *  If the queried data is older than what we stored, that counts as a fail.
     60     **/
    4761    public void runJob() {
    4862        _target = pickTarget();
     
    119133            long delay = getContext().clock().now() - _sendTime;
    120134            if (_message instanceof DatabaseStoreMessage) {
    121                 // store ok, w00t!
    122                 // Hmm should we verify it's as recent as the one we sent???
    123                 getContext().profileManager().dbLookupSuccessful(_target, delay);
    124                 getContext().statManager().addRateData("netDb.floodfillVerifyOK", delay, 0);
    125             } else {
    126                 // store failed, boo, hiss!
    127                 if (_message instanceof DatabaseSearchReplyMessage) {
    128                     // assume 0 old, all new, 0 invalid, 0 dup
    129                     getContext().profileManager().dbLookupReply(_target,  0,
     135                // Verify it's as recent as the one we sent
     136                boolean success = false;
     137                DatabaseStoreMessage dsm = (DatabaseStoreMessage)_message;
     138                if (_isRouterInfo && dsm.getValueType() == DatabaseStoreMessage.KEY_TYPE_ROUTERINFO)
     139                    success = dsm.getRouterInfo().getPublished() >= _published;
     140                else if ((!_isRouterInfo) && dsm.getValueType() == DatabaseStoreMessage.KEY_TYPE_LEASESET)
     141                    success = dsm.getLeaseSet().getEarliestLeaseDate() >= _published;
     142                if (success) {
     143                    // store ok, w00t!
     144                    getContext().profileManager().dbLookupSuccessful(_target, delay);
     145                    getContext().statManager().addRateData("netDb.floodfillVerifyOK", delay, 0);
     146                    return;
     147                }
     148                if (_log.shouldLog(Log.WARN))
     149                    _log.warn("Verify failed - older");
     150            } else if (_message instanceof DatabaseSearchReplyMessage) {
     151                // assume 0 old, all new, 0 invalid, 0 dup
     152                getContext().profileManager().dbLookupReply(_target,  0,
    130153                                ((DatabaseSearchReplyMessage)_message).getNumReplies(), 0, 0, delay);
    131                 }
    132                 getContext().statManager().addRateData("netDb.floodfillVerifyFail", delay, 0);
    133                 resend();
    134154            }
     155            // store failed, boo, hiss!
     156            getContext().statManager().addRateData("netDb.floodfillVerifyFail", delay, 0);
     157            resend();
    135158        }       
    136159        public void setMessage(I2NPMessage message) { _message = message; }
  • router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java

    r87eafa3 r9234a94  
    628628        long now = _context.clock().now();
    629629        boolean upLongEnough = _context.router().getUptime() > 60*60*1000;
    630         // Once we're over 300 routers, reduce the expiration time down from the default,
     630        // Once we're over 150 routers, reduce the expiration time down from the default,
    631631        // as a crude way of limiting memory usage.
    632         // i.e. at 600 routers the expiration time will be about half the default, etc.
     632        // i.e. at 300 routers the expiration time will be about half the default, etc.
    633633        // And if we're floodfill, we can keep the expiration really short, since
    634634        // we are always getting the latest published to us.
     
    639639            adjustedExpiration = ROUTER_INFO_EXPIRATION_FLOODFILL;
    640640        else
     641            // _kb.size() includes leasesets but that's ok
    641642            adjustedExpiration = Math.min(ROUTER_INFO_EXPIRATION,
    642643                                          ROUTER_INFO_EXPIRATION_MIN +
    643                                           ((ROUTER_INFO_EXPIRATION - ROUTER_INFO_EXPIRATION_MIN) * 300 / (_kb.size() + 1)));
     644                                          ((ROUTER_INFO_EXPIRATION - ROUTER_INFO_EXPIRATION_MIN) * 150 / (_kb.size() + 1)));
    644645
    645646        if (!key.equals(routerInfo.getIdentity().getHash())) {
Note: See TracChangeset for help on using the changeset viewer.