Changeset 1b2d4c7


Ignore:
Timestamp:
Jun 19, 2015 3:55:07 PM (5 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
c6896c44
Parents:
586defc
Message:

I2CP: Fix simple session lookups, broken in prop

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/client/impl/I2PSessionImpl.java

    r586defc r1b2d4c7  
    4343import net.i2p.data.SigningPrivateKey;
    4444import net.i2p.data.i2cp.DestLookupMessage;
     45import net.i2p.data.i2cp.DestReplyMessage;
    4546import net.i2p.data.i2cp.GetBandwidthLimitsMessage;
    4647import net.i2p.data.i2cp.GetDateMessage;
    4748import net.i2p.data.i2cp.HostLookupMessage;
     49import net.i2p.data.i2cp.HostReplyMessage;
    4850import net.i2p.data.i2cp.I2CPMessage;
    4951import net.i2p.data.i2cp.I2CPMessageReader;
     
    901903        SessionId currId = _sessionId;
    902904        if (id == null || id.equals(currId) ||
    903             (currId == null && id != null && type == SessionStatusMessage.MESSAGE_TYPE)) {
     905            (currId == null && id != null && type == SessionStatusMessage.MESSAGE_TYPE) ||
     906            ((id == null || id.getSessionId() == 65535) &&
     907             (type == HostReplyMessage.MESSAGE_TYPE || type == DestReplyMessage.MESSAGE_TYPE))) {
    904908            // it's for us
    905909            I2CPMessageHandler handler = _handlerMap.getHandler(type);
  • history.txt

    r586defc r1b2d4c7  
    112015-06-19 zzz
     2 * I2CP: Fix simple session lookups, broken in prop
    23 * I2PSocketEepGet: Do hostname lookups in-session for efficiency
    34 * Tunnels: Increase default max tunnels
  • router/java/src/net/i2p/router/RouterVersion.java

    r586defc r1b2d4c7  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 7;
     21    public final static long BUILD = 8;
    2222
    2323    /** for example "-test" */
  • router/java/src/net/i2p/router/client/ClientConnectionRunner.java

    r586defc r1b2d4c7  
    304304     *  Equivalent to getConfig().getDestination().calculateHash();
    305305     *  will be null before session is established
    306      *  Not subsession aware. Returns random hash from the sessions.
     306     *  Not subsession aware. Returns primary session hash.
    307307     *  Don't use if you can help it.
    308308     *
     
    310310     */
    311311    public Hash getDestHash() {
    312         for (Hash h : _sessions.keySet()) {
    313             return h;
    314         }
     312        SessionConfig cfg = getPrimaryConfig();
     313        if (cfg != null)
     314            return cfg.getDestination().calculateHash();
    315315        return null;
    316316    }
     
    891891            if (sp == null) {
    892892                if (_log.shouldLog(Log.WARN))
    893                     _log.warn("cancelling rerequest, session went away");
     893                    _log.warn("cancelling rerequest, session went away: " + h);
    894894                return;
    895895            }
     
    897897                if (sp.rerequestTimer != Rerequest.this) {
    898898                    if (_log.shouldLog(Log.WARN))
    899                         _log.warn("cancelling rerequest, newer request came in");
     899                        _log.warn("cancelling rerequest, newer request came in: " + h);
    900900                    return;
    901901                }
    902902            }
    903             requestLeaseSet(_ls.getDestination().calculateHash(), _ls, _expirationTime, _onCreate, _onFailed);
     903            requestLeaseSet(h, _ls, _expirationTime, _onCreate, _onFailed);
    904904        }
    905905    }
  • router/java/src/net/i2p/router/client/ClientMessageEventListener.java

    r586defc r1b2d4c7  
    541541     */
    542542    protected void handleHostLookup(HostLookupMessage message) {
    543         Hash h = _runner.getDestHash(message.getSessionId());
    544         if (h == null)
    545             return;  // ok?
     543        SessionId sid = message.getSessionId();
     544        Hash h;
     545        if (sid != null) {
     546            h = _runner.getDestHash(sid);
     547        } else {
     548            // fixup if necessary
     549            if (message.getReqID() >= 0)
     550                sid = new SessionId(65535);
     551            h = null;
     552        }
     553        if (h == null) {
     554            h = _runner.getDestHash();
     555            // h may still be null, an LS lookup for b32 will go out expl. tunnels
     556        }
    546557        _context.jobQueue().addJob(new LookupDestJob(_context, _runner, message.getReqID(),
    547                                                      message.getTimeout(), message.getSessionId(),
     558                                                     message.getTimeout(), sid,
    548559                                                     message.getHash(), message.getHostname(), h));
    549560    }
Note: See TracChangeset for help on using the changeset viewer.