propagate from branch 'i2p.i2p.zzz.test2' (head ee7dbea07e8ad7e01cb8012a1540aca8346ee7d2)

to branch 'i2p.i2p' (head 2cb447c64ae706c6cead619c9428083fce6f1d46)
This commit is contained in:
zzz
2016-06-11 13:47:12 +00:00
21 changed files with 434 additions and 210 deletions

View File

@ -71,9 +71,8 @@ public class StatisticsManager {
public Properties publishStatistics(Hash h) {
Properties stats = new Properties();
stats.setProperty("router.version", RouterVersion.VERSION);
// scheduled for removal, never used
if (CoreVersion.VERSION.equals("0.9.23"))
stats.setProperty("coreVersion", CoreVersion.VERSION);
// never used
//stats.setProperty("coreVersion", CoreVersion.VERSION);
stats.setProperty(RouterInfo.PROP_NETWORK_ID, _networkID);
stats.setProperty(RouterInfo.PROP_CAPABILITIES, _context.router().getCapabilities());
@ -168,9 +167,7 @@ public class StatisticsManager {
}
// So that we will still get build requests - not required since 0.7.9 2010-01-12
// scheduled for removal
if (CoreVersion.VERSION.equals("0.9.23"))
stats.setProperty("stat_uptime", "90m");
//stats.setProperty("stat_uptime", "90m");
if (FloodfillNetworkDatabaseFacade.isFloodfill(_context.router().getRouterInfo())) {
int ri = _context.router().getUptime() > 30*60*1000 ?
_context.netDb().getKnownRouters() :

View File

@ -232,6 +232,7 @@ class FloodOnlySearchJob extends FloodSearchJob {
synchronized (this) {
if (_dead) return;
_dead = true;
super.success();
}
if (_log.shouldLog(Log.INFO))
_log.info(getJobId() + ": Floodfill search for " + _key + " successful");

View File

@ -33,6 +33,7 @@ public class FloodSearchJob extends JobImpl {
protected final AtomicInteger _lookupsRemaining = new AtomicInteger();
protected volatile boolean _dead;
protected final long _created;
protected boolean _success;
/**
* @param onFind may be null
@ -69,6 +70,7 @@ public class FloodSearchJob extends JobImpl {
* @param isLease ignored
*/
void addDeferred(Job onFind, Job onFailed, long timeoutMs, boolean isLease) {
boolean success;
synchronized (this) {
if (!_dead) {
if (onFind != null)
@ -77,9 +79,13 @@ public class FloodSearchJob extends JobImpl {
_onFailed.add(onFailed);
return;
}
success = _success;
}
// outside synch to avoid deadlock with job queue
getContext().jobQueue().addJob(onFailed);
if (success && onFind != null)
getContext().jobQueue().addJob(onFind);
else if (!success && onFailed != null)
getContext().jobQueue().addJob(onFailed);
}
/** using context clock */
@ -193,8 +199,11 @@ public class FloodSearchJob extends JobImpl {
* Deprecated, unused, see FOSJ override
*/
void success() {
throw new UnsupportedOperationException("use override");
synchronized(this) {
_success = true;
}
/****
throw new UnsupportedOperationException("use override");
if (_dead) return;
if (_log.shouldLog(Log.INFO))
_log.info(getJobId() + ": Floodfill search for " + _key.toBase64() + " successful");

View File

@ -587,6 +587,7 @@ class IterativeSearchJob extends FloodSearchJob {
synchronized(this) {
if (_dead) return;
_dead = true;
_success = true;
tries = _unheardFrom.size() + _failedPeers.size();
if (_unheardFrom.size() == 1) {
peer = _unheardFrom.iterator().next();