forked from I2P_Developers/i2p.i2p
NetDb: Fix deadlock (ticket #1722)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
2015-12-03 zzz
|
||||
* Console: Add experimental Sybil analysis tool
|
||||
* NetDb: Fix deadlock (ticket #1722)
|
||||
|
||||
2015-12-01 zzz
|
||||
* i2psnark:
|
||||
|
||||
@@ -488,6 +488,9 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
/**
|
||||
* Our current router info.
|
||||
* Warning, may be null if called very early.
|
||||
*
|
||||
* Warning - risk of deadlock - do not call while holding locks
|
||||
*
|
||||
*/
|
||||
public RouterInfo getRouterInfo() {
|
||||
synchronized (_routerInfoLock) {
|
||||
@@ -498,6 +501,9 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
/**
|
||||
* Caller must ensure info is valid - no validation done here.
|
||||
* Not for external use.
|
||||
*
|
||||
* Warning - risk of deadlock - do not call while holding locks
|
||||
*
|
||||
*/
|
||||
public void setRouterInfo(RouterInfo info) {
|
||||
synchronized (_routerInfoLock) {
|
||||
@@ -806,6 +812,9 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
* Rebuild and republish our routerInfo since something significant
|
||||
* has changed.
|
||||
* Not for external use.
|
||||
*
|
||||
* Warning - risk of deadlock - do not call while holding locks
|
||||
*
|
||||
*/
|
||||
public void rebuildRouterInfo(boolean blockingRebuild) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
@@ -959,6 +968,11 @@ public class Router implements RouterClock.ClockShiftListener {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* Warning - risk of deadlock - do not call while holding locks
|
||||
*
|
||||
*/
|
||||
public boolean isHidden() {
|
||||
RouterInfo ri;
|
||||
synchronized (_routerInfoLock) {
|
||||
|
||||
@@ -261,6 +261,9 @@ public class RouterContext extends I2PAppContext {
|
||||
/**
|
||||
* Convenience method for getting the router hash.
|
||||
* Equivalent to context.router().getRouterInfo().getIdentity().getHash()
|
||||
*
|
||||
* Warning - risk of deadlock - do not call while holding locks
|
||||
*
|
||||
* @return may be null if called very early
|
||||
*/
|
||||
public Hash routerHash() {
|
||||
|
||||
@@ -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 = "";
|
||||
|
||||
@@ -199,10 +199,12 @@ class IterativeSearchJob extends FloodSearchJob {
|
||||
}
|
||||
}
|
||||
final boolean empty;
|
||||
// outside sync to avoid deadlock
|
||||
final Hash us = getContext().routerHash();
|
||||
synchronized(this) {
|
||||
_toTry.addAll(floodfillPeers);
|
||||
// don't ask ourselves or the target
|
||||
_toTry.remove(getContext().routerHash());
|
||||
_toTry.remove(us);
|
||||
_toTry.remove(_key);
|
||||
empty = _toTry.isEmpty();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user