forked from I2P_Developers/i2p.i2p
* UDP:
- Locking fixes on rebuilding address - Don't rapidly churn address when we don't have enough introducers
This commit is contained in:
16
history.txt
16
history.txt
@@ -1,3 +1,18 @@
|
|||||||
|
2014-04-27 zzz
|
||||||
|
* NTCP: Remove published NTCP address if SSU becomes firewalled,
|
||||||
|
to fix the "Firewalled with NTCP enabled" message
|
||||||
|
* Router: Set killVMOnEnd before runRouter() (for azi2phelper)
|
||||||
|
* RoutingKeyGenerator: Don't assume UTC (for azi2phelper)
|
||||||
|
* SusiMail:
|
||||||
|
- Add locking for disk cache
|
||||||
|
- Remove cancel button from login page
|
||||||
|
- New configuration page
|
||||||
|
- Move set page form to configuration page
|
||||||
|
- Theme and js enhancements
|
||||||
|
* UDP:
|
||||||
|
- Locking fixes on rebuilding address
|
||||||
|
- Don't rapidly churn address when we don't have enough introducers
|
||||||
|
|
||||||
2014-04-25 zzz
|
2014-04-25 zzz
|
||||||
* SusiMail:
|
* SusiMail:
|
||||||
- Add icons for new messages, attachments, and spam
|
- Add icons for new messages, attachments, and spam
|
||||||
@@ -9,6 +24,7 @@
|
|||||||
- Increase max size for full download again
|
- Increase max size for full download again
|
||||||
- Fix repeated re-saves of mail to disk
|
- Fix repeated re-saves of mail to disk
|
||||||
- Enable auto-deletion of downloaded mails
|
- Enable auto-deletion of downloaded mails
|
||||||
|
- Send delete to server for mails already downloaded
|
||||||
|
|
||||||
2014-04-24 zzz
|
2014-04-24 zzz
|
||||||
* SusiMail:
|
* SusiMail:
|
||||||
|
@@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 12;
|
public final static long BUILD = 13;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
@@ -91,6 +91,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
|
|
||||||
/** do we need to rebuild our external router address asap? */
|
/** do we need to rebuild our external router address asap? */
|
||||||
private boolean _needsRebuild;
|
private boolean _needsRebuild;
|
||||||
|
private final Object _rebuildLock = new Object();
|
||||||
|
|
||||||
/** introduction key */
|
/** introduction key */
|
||||||
private SessionKey _introKey;
|
private SessionKey _introKey;
|
||||||
@@ -1159,8 +1160,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
if (oldEstablishedOn > 0)
|
if (oldEstablishedOn > 0)
|
||||||
_context.statManager().addRateData("udp.alreadyConnected", oldEstablishedOn, 0);
|
_context.statManager().addRateData("udp.alreadyConnected", oldEstablishedOn, 0);
|
||||||
|
|
||||||
if (needsRebuild())
|
rebuildIfNecessary();
|
||||||
rebuildExternalAddress();
|
|
||||||
|
|
||||||
if (getReachabilityStatus() != CommSystemFacade.STATUS_OK) {
|
if (getReachabilityStatus() != CommSystemFacade.STATUS_OK) {
|
||||||
_testEvent.forceRun();
|
_testEvent.forceRun();
|
||||||
@@ -1303,8 +1303,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
synchronized(_addDropLock) {
|
synchronized(_addDropLock) {
|
||||||
locked_dropPeer(peer, shouldBanlist, why);
|
locked_dropPeer(peer, shouldBanlist, why);
|
||||||
}
|
}
|
||||||
if (needsRebuild())
|
rebuildIfNecessary();
|
||||||
rebuildExternalAddress();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void locked_dropPeer(PeerState peer, boolean shouldBanlist, String why) {
|
private void locked_dropPeer(PeerState peer, boolean shouldBanlist, String why) {
|
||||||
@@ -1349,9 +1348,16 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the IPv4 external address need to be rebuilt?
|
* Rebuild the IPv4 external address if required
|
||||||
*/
|
*/
|
||||||
private boolean needsRebuild() {
|
private void rebuildIfNecessary() {
|
||||||
|
synchronized (_rebuildLock) {
|
||||||
|
if (locked_needsRebuild())
|
||||||
|
rebuildExternalAddress();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean locked_needsRebuild() {
|
||||||
if (_needsRebuild) return true; // simple enough
|
if (_needsRebuild) return true; // simple enough
|
||||||
if (_context.router().isHidden()) return false;
|
if (_context.router().isHidden()) return false;
|
||||||
RouterAddress addr = getCurrentAddress(false);
|
RouterAddress addr = getCurrentAddress(false);
|
||||||
@@ -1367,21 +1373,29 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
if (peer != null)
|
if (peer != null)
|
||||||
valid++;
|
valid++;
|
||||||
}
|
}
|
||||||
|
long sinceSelected = _context.clock().now() - _introducersSelectedOn;
|
||||||
if (valid >= PUBLIC_RELAY_COUNT) {
|
if (valid >= PUBLIC_RELAY_COUNT) {
|
||||||
// try to shift 'em around every 10 minutes or so
|
// try to shift 'em around every 10 minutes or so
|
||||||
if (_introducersSelectedOn < _context.clock().now() - 10*60*1000) {
|
if (sinceSelected > 10*60*1000) {
|
||||||
if (_log.shouldLog(Log.WARN))
|
if (_log.shouldLog(Log.WARN))
|
||||||
_log.warn("Our introducers are valid, but havent changed in a while, so lets rechoose");
|
_log.warn("Our introducers are valid, but haven't changed in " + DataHelper.formatDuration(sinceSelected) + ", so lets rechoose");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
_log.info("Our introducers are valid and haven't changed in a while");
|
_log.info("Our introducers are valid and were selected " + DataHelper.formatDuration(sinceSelected) + " ago");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else if (sinceSelected > 2*60*1000) {
|
||||||
|
// Rate limit to prevent rapid churn after transition to firewalled or at startup
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
_log.info("Need more introducers (have " +valid + " need " + PUBLIC_RELAY_COUNT + ')');
|
_log.info("Need more introducers (have " +valid + " need " + PUBLIC_RELAY_COUNT + ')');
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
if (_log.shouldLog(Log.INFO))
|
||||||
|
_log.info("Need more introducers (have " +valid + " need " + PUBLIC_RELAY_COUNT + ')' +
|
||||||
|
" but we just chose them " + DataHelper.formatDuration(sinceSelected) + " ago so wait");
|
||||||
|
// TODO also check to see if we actually have more available
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
byte[] externalListenHost = addr != null ? addr.getIP() : null;
|
byte[] externalListenHost = addr != null ? addr.getIP() : null;
|
||||||
@@ -1792,6 +1806,12 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
* @since IPv6
|
* @since IPv6
|
||||||
*/
|
*/
|
||||||
private RouterAddress rebuildExternalAddress(String host, int port, boolean allowRebuildRouterInfo) {
|
private RouterAddress rebuildExternalAddress(String host, int port, boolean allowRebuildRouterInfo) {
|
||||||
|
synchronized (_rebuildLock) {
|
||||||
|
return locked_rebuildExternalAddress(host, port, allowRebuildRouterInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private RouterAddress locked_rebuildExternalAddress(String host, int port, boolean allowRebuildRouterInfo) {
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("REA4 " + host + ':' + port);
|
_log.debug("REA4 " + host + ':' + port);
|
||||||
if (_context.router().isHidden())
|
if (_context.router().isHidden())
|
||||||
@@ -1802,6 +1822,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
// DNS name assumed IPv4
|
// DNS name assumed IPv4
|
||||||
boolean isIPv6 = host != null && host.contains(":");
|
boolean isIPv6 = host != null && host.contains(":");
|
||||||
if (allowDirectUDP() && port > 0 && host != null) {
|
if (allowDirectUDP() && port > 0 && host != null) {
|
||||||
|
// TODO don't add these if we have (or require?) introducers
|
||||||
options.setProperty(UDPAddress.PROP_PORT, String.valueOf(port));
|
options.setProperty(UDPAddress.PROP_PORT, String.valueOf(port));
|
||||||
options.setProperty(UDPAddress.PROP_HOST, host);
|
options.setProperty(UDPAddress.PROP_HOST, host);
|
||||||
directIncluded = true;
|
directIncluded = true;
|
||||||
@@ -2948,6 +2969,12 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setReachabilityStatus(short status) {
|
void setReachabilityStatus(short status) {
|
||||||
|
synchronized (_rebuildLock) {
|
||||||
|
locked_setReachabilityStatus(status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void locked_setReachabilityStatus(short status) {
|
||||||
short old = _reachabilityStatus;
|
short old = _reachabilityStatus;
|
||||||
long now = _context.clock().now();
|
long now = _context.clock().now();
|
||||||
switch (status) {
|
switch (status) {
|
||||||
@@ -2997,6 +3024,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
rebuildExternalAddress();
|
rebuildExternalAddress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String PROP_REACHABILITY_STATUS_OVERRIDE = "i2np.udp.status";
|
private static final String PROP_REACHABILITY_STATUS_OVERRIDE = "i2np.udp.status";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user