Changeset ba9754a


Ignore:
Timestamp:
Sep 16, 2011 2:34:52 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
1d179813
Parents:
9a45ba1
Message:
  • Router: Fix router changing client-side tunnel options, causing original tunnel quantity to not be restored (ticket #513)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/client/ClientMessageEventListener.java

    r9a45ba1 rba9754a  
    3030import net.i2p.data.i2cp.SendMessageMessage;
    3131import net.i2p.data.i2cp.SendMessageExpiresMessage;
     32import net.i2p.data.i2cp.SessionConfig;
    3233import net.i2p.data.i2cp.SessionId;
    3334import net.i2p.data.i2cp.SessionStatusMessage;
     
    157158     */
    158159    private void handleCreateSession(I2CPMessageReader reader, CreateSessionMessage message) {
    159         if (message.getSessionConfig().verifySignature()) {
     160        SessionConfig in = message.getSessionConfig();
     161        if (in.verifySignature()) {
    160162            if (_log.shouldLog(Log.DEBUG))
    161163                _log.debug("Signature verified correctly on create session message");
     
    172174            String configPW = _context.getProperty("i2cp.password");
    173175            if (configUser != null && configPW != null) {
    174                 Properties props = message.getSessionConfig().getOptions();
     176                Properties props = in.getOptions();
    175177                String user = props.getProperty("i2cp.username");
    176178                String pw = props.getProperty("i2cp.password");
     
    194196        _runner.setSessionId(sessionId);
    195197        sendStatusMessage(SessionStatusMessage.STATUS_CREATED);
    196         _runner.sessionEstablished(message.getSessionConfig());
     198
     199        // Copy over the whole config structure so we don't later corrupt it on
     200        // the client side if we change settings or later get a
     201        // ReconfigureSessionMessage
     202        SessionConfig cfg = new SessionConfig(in.getDestination());
     203        cfg.setSignature(in.getSignature());
     204        Properties props = new Properties();
     205        props.putAll(in.getOptions());
     206        cfg.setOptions(props);
     207        _runner.sessionEstablished(cfg);
     208
    197209        if (_log.shouldLog(Log.DEBUG))
    198210            _log.debug("after sessionEstablished for " + message.getSessionConfig().getDestination().calculateHash().toBase64());
     
    286298     * Message's Session ID ignored. This doesn't support removing previously set options.
    287299     * Nor do we bother with message.getSessionConfig().verifySignature() ... should we?
    288      *
     300     * Nor is the Date checked.
    289301     */
    290302    private void handleReconfigureSession(I2CPMessageReader reader, ReconfigureSessionMessage message) {
Note: See TracChangeset for help on using the changeset viewer.