* I2CP: Don't send SendMessageEndMessages from client to router if

in fast receive mode and the router doesn't require them.
This commit is contained in:
zzz
2013-06-17 19:57:59 +00:00
parent 00d1b7519f
commit 7e0654ae0a
5 changed files with 25 additions and 7 deletions

View File

@@ -47,6 +47,7 @@ import net.i2p.util.LHMCache;
import net.i2p.util.Log;
import net.i2p.util.SimpleScheduler;
import net.i2p.util.SimpleTimer;
import net.i2p.util.VersionComparator;
/**
* Implementation of an I2P session running over TCP. This class is NOT thread safe -
@@ -137,6 +138,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
private long _lastActivity;
private boolean _isReduced;
private final boolean _fastReceive;
private volatile boolean _routerSupportsFastReceive;
/**
* @since 0.8.9
@@ -150,7 +152,13 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
private static final long MAX_SEND_WAIT = 10*1000;
void dateUpdated() {
private static final String MIN_FAST_VERSION = "0.9.4";
/** @param routerVersion as rcvd in the SetDateMessage, may be null for very old routers */
void dateUpdated(String routerVersion) {
_routerSupportsFastReceive = _context.isRouterContext() ||
(routerVersion != null && routerVersion.length() > 0 &&
VersionComparator.comp(routerVersion, MIN_FAST_VERSION) >= 0);
_dateReceived = true;
synchronized (_dateReceivedLock) {
_dateReceivedLock.notifyAll();
@@ -290,7 +298,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
* @since 0.9.4
*/
public boolean getFastReceive() {
return _fastReceive;
return _fastReceive && _routerSupportsFastReceive;
}
void setLeaseSet(LeaseSet ls) {

View File

@@ -44,15 +44,15 @@ class MessagePayloadMessageHandler extends HandlerImpl {
// if we are a new I2P lib talking to an old router
// and we don't send this, the router will OOM as it has
// no cleaner for old messages.
// TODO after 0.9.4 is out, check router version from handshake
// Check router version from handshake
// and send it all the time if 0.9.3 or less
// (needs router version saving support in SetDateMessageHandler)
//if (!session.getFastReceive()) {
if (!session.getFastReceive()) {
ReceiveMessageEndMessage m = new ReceiveMessageEndMessage();
m.setMessageId(id);
m.setSessionId(msg.getSessionId());
session.sendMessage(m);
//}
}
} catch (DataFormatException dfe) {
session.propogateError("Error handling a new payload message", dfe);
} catch (I2PSessionException ise) {

View File

@@ -35,6 +35,6 @@ class SetDateMessageHandler extends HandlerImpl {
if (!_context.isRouterContext())
Clock.getInstance().setNow(msg.getDate().getTime());
// TODO - save router's version string for future reference
session.dateUpdated();
session.dateUpdated(msg.getVersion());
}
}

View File

@@ -1,3 +1,13 @@
2013-06-17 zzz
* Console: Don't display 'unsupported' message when restart button clicked
* I2CP: Don't send SendMessageEndMessages from client to router if
in fast receive mode and the router doesn't require them.
* NetDB:
- Don't instantiate unused success job for republish LS
- Add debug setting to encrypt RI lookups
* NTCP: Extend interval for sending time sync messages
* SusiMail: Fix classpath problem when started manually (ticket #957)
2013-06-14 zzz
* I2CP: Fix deserialization of new RVLSM; enable by default
* i2psnark: Fix bug creating torrent with a single file in a directory

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 = 9;
public final static long BUILD = 10;
/** for example "-test" */
public final static String EXTRA = "";