Changeset 17228de


Ignore:
Timestamp:
Jan 10, 2019 5:08:35 PM (18 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
47beb82, b62732b
Parents:
5ca9802
Message:

I2CP: Remove client-side-only options from those sent to router

File:
1 edited

Legend:

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

    r5ca9802 r17228de  
    1616
    1717import net.i2p.I2PAppContext;
     18import net.i2p.client.I2PClient;
    1819import net.i2p.client.I2PSessionException;
    1920import net.i2p.client.SendMessageOptions;
     
    5960    private static final int MIN_RATE = 2 * TYP_SIZE;
    6061
     62    // http://i2p-projekt.i2p/en/docs/protocol/i2cp
     63    // Note that some are listed for both client and server side, don't include those below.
     64    private static final String[] CLIENT_SIDE_OPTIONS = new String[] {
     65        "i2cp.closeIdleTime", "i2cp.closeOnIdle", "i2cp.encryptLeaseSet",
     66        "i2cp.gzip", "i2cp.leaseSetKey", "i2cp.leaseSetPrivateKey",
     67        "i2cp.leaseSetSigningPrivateKey", "i2cp.reduceIdleTime", "i2cp.reduceOnIdle",
     68        I2PSessionImpl.PROP_ENABLE_SSL, I2PClient.PROP_TCP_HOST, I2PClient.PROP_TCP_PORT
     69    };
     70
     71
    6172    public I2CPMessageProducer(I2PAppContext context) {
    6273        _context = context;
     
    8899
    89100    /**
     101     * Strip out the client-side options from the session options.
     102     * @return a new copy, may be modified
     103     * @since 0.9.38
     104     */
     105    private static Properties getRouterOptions(I2PSessionImpl session) {
     106        Properties props = new Properties();
     107        props.putAll(session.getOptions());
     108        for (int i = 0; i < CLIENT_SIDE_OPTIONS.length; i++) {
     109            props.remove(CLIENT_SIDE_OPTIONS[i]);
     110        }
     111        return props;
     112    }
     113
     114    /**
    90115     * Send all the messages that a client needs to send to a router to establish
    91116     * a new session. 
     
    95120        CreateSessionMessage msg = new CreateSessionMessage();
    96121        SessionConfig cfg = new SessionConfig(session.getMyDestination());
    97         cfg.setOptions(session.getOptions());
     122        cfg.setOptions(getRouterOptions(session));
    98123        if (session.isOffline()) {
    99124            cfg.setOfflineSignature(session.getOfflineExpiration(),
     
    366391        ReconfigureSessionMessage msg = new ReconfigureSessionMessage();
    367392        SessionConfig cfg = new SessionConfig(session.getMyDestination());
    368         Properties props = session.getOptions();
     393        Properties props = getRouterOptions(session);
    369394        if (tunnels > 0) {
    370             Properties newprops = new Properties();
    371             newprops.putAll(props);
    372             props = newprops;
    373395            String stunnels = Integer.toString(tunnels);
    374396            props.setProperty("inbound.quantity", stunnels);
Note: See TracChangeset for help on using the changeset viewer.