another NPE from ticket 493

This commit is contained in:
zzz
2011-07-08 19:03:38 +00:00
parent 90b8aa7811
commit b41c58341f
3 changed files with 14 additions and 4 deletions

View File

@ -1,7 +1,8 @@
2011-07-08 zzz
* Findbugs: Several fixes and cleanups
* I2NP: Consolidate common code from TunnelBuildMessage and
TunnelBuildReplyMessage into a common base class
* NetDB: Fix NPE at startup (ticket #493)
* NetDB, TestJob: Fix NPEs at startup (ticket #493)
* Sha256Standalone:
- Use system SHA-256 MessageDigest instead of Sha256Standalone in PRNG
- Deprecate DataHelper functions using Sha256Standalone arguments;

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 7;
public final static long BUILD = 8;
/** for example "-test" */
public final static String EXTRA = "";

View File

@ -19,6 +19,8 @@ import net.i2p.router.RouterContext;
import net.i2p.router.TunnelInfo;
import net.i2p.router.message.GarlicMessageBuilder;
import net.i2p.router.message.PayloadGarlicConfig;
import net.i2p.stat.Rate;
import net.i2p.stat.RateStat;
import net.i2p.util.Log;
class TestJob extends JobImpl {
@ -219,8 +221,15 @@ class TestJob extends JobImpl {
//
// Try to prevent congestion collapse (failing all our tunnels and then clogging our outbound
// with new tunnel build requests) by adding in three times the average outbound delay.
int delay = 3 * (int) getContext().statManager().getRate("transport.sendProcessingTime").getRate(60*1000).getAverageValue();
return delay + (2500 * (_outTunnel.getLength() + _replyTunnel.getLength()));
RateStat tspt = getContext().statManager().getRate("transport.sendProcessingTime");
if (tspt != null) {
Rate r = tspt.getRate(60*1000);
if (r != null) {
int delay = 3 * (int) r.getAverageValue();
return delay + (2500 * (_outTunnel.getLength() + _replyTunnel.getLength()));
}
}
return 15*1000;
}
private void scheduleRetest() { scheduleRetest(false); }