forked from I2P_Developers/i2p.i2p
I2CP: Fix simple session lookups, broken in prop
This commit is contained in:
@ -42,9 +42,11 @@ import net.i2p.data.LeaseSet;
|
||||
import net.i2p.data.PrivateKey;
|
||||
import net.i2p.data.SigningPrivateKey;
|
||||
import net.i2p.data.i2cp.DestLookupMessage;
|
||||
import net.i2p.data.i2cp.DestReplyMessage;
|
||||
import net.i2p.data.i2cp.GetBandwidthLimitsMessage;
|
||||
import net.i2p.data.i2cp.GetDateMessage;
|
||||
import net.i2p.data.i2cp.HostLookupMessage;
|
||||
import net.i2p.data.i2cp.HostReplyMessage;
|
||||
import net.i2p.data.i2cp.I2CPMessage;
|
||||
import net.i2p.data.i2cp.I2CPMessageReader;
|
||||
import net.i2p.data.i2cp.MessagePayloadMessage;
|
||||
@ -900,7 +902,9 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2
|
||||
SessionId id = message.sessionId();
|
||||
SessionId currId = _sessionId;
|
||||
if (id == null || id.equals(currId) ||
|
||||
(currId == null && id != null && type == SessionStatusMessage.MESSAGE_TYPE)) {
|
||||
(currId == null && id != null && type == SessionStatusMessage.MESSAGE_TYPE) ||
|
||||
((id == null || id.getSessionId() == 65535) &&
|
||||
(type == HostReplyMessage.MESSAGE_TYPE || type == DestReplyMessage.MESSAGE_TYPE))) {
|
||||
// it's for us
|
||||
I2CPMessageHandler handler = _handlerMap.getHandler(type);
|
||||
if (handler != null) {
|
||||
|
@ -1,4 +1,5 @@
|
||||
2015-06-19 zzz
|
||||
* I2CP: Fix simple session lookups, broken in prop
|
||||
* I2PSocketEepGet: Do hostname lookups in-session for efficiency
|
||||
* Tunnels: Increase default max tunnels
|
||||
|
||||
|
@ -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 = "";
|
||||
|
@ -303,15 +303,15 @@ class ClientConnectionRunner {
|
||||
/**
|
||||
* Equivalent to getConfig().getDestination().calculateHash();
|
||||
* will be null before session is established
|
||||
* Not subsession aware. Returns random hash from the sessions.
|
||||
* Not subsession aware. Returns primary session hash.
|
||||
* Don't use if you can help it.
|
||||
*
|
||||
* @return primary hash or null if not yet set
|
||||
*/
|
||||
public Hash getDestHash() {
|
||||
for (Hash h : _sessions.keySet()) {
|
||||
return h;
|
||||
}
|
||||
SessionConfig cfg = getPrimaryConfig();
|
||||
if (cfg != null)
|
||||
return cfg.getDestination().calculateHash();
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -890,17 +890,17 @@ class ClientConnectionRunner {
|
||||
SessionParams sp = _sessions.get(h);
|
||||
if (sp == null) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("cancelling rerequest, session went away");
|
||||
_log.warn("cancelling rerequest, session went away: " + h);
|
||||
return;
|
||||
}
|
||||
synchronized(ClientConnectionRunner.this) {
|
||||
if (sp.rerequestTimer != Rerequest.this) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("cancelling rerequest, newer request came in");
|
||||
_log.warn("cancelling rerequest, newer request came in: " + h);
|
||||
return;
|
||||
}
|
||||
}
|
||||
requestLeaseSet(_ls.getDestination().calculateHash(), _ls, _expirationTime, _onCreate, _onFailed);
|
||||
requestLeaseSet(h, _ls, _expirationTime, _onCreate, _onFailed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -540,11 +540,22 @@ class ClientMessageEventListener implements I2CPMessageReader.I2CPMessageEventLi
|
||||
* @since 0.9.11
|
||||
*/
|
||||
protected void handleHostLookup(HostLookupMessage message) {
|
||||
Hash h = _runner.getDestHash(message.getSessionId());
|
||||
if (h == null)
|
||||
return; // ok?
|
||||
SessionId sid = message.getSessionId();
|
||||
Hash h;
|
||||
if (sid != null) {
|
||||
h = _runner.getDestHash(sid);
|
||||
} else {
|
||||
// fixup if necessary
|
||||
if (message.getReqID() >= 0)
|
||||
sid = new SessionId(65535);
|
||||
h = null;
|
||||
}
|
||||
if (h == null) {
|
||||
h = _runner.getDestHash();
|
||||
// h may still be null, an LS lookup for b32 will go out expl. tunnels
|
||||
}
|
||||
_context.jobQueue().addJob(new LookupDestJob(_context, _runner, message.getReqID(),
|
||||
message.getTimeout(), message.getSessionId(),
|
||||
message.getTimeout(), sid,
|
||||
message.getHash(), message.getHostname(), h));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user