forked from I2P_Developers/i2p.i2p
Fix changing outproxy without stopping tunnel (ticket #1164)
This commit is contained in:
@ -16,6 +16,8 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
@ -171,6 +173,33 @@ public abstract class I2PTunnelHTTPClientBase extends I2PTunnelClientBase implem
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the outproxy list then call super.
|
||||
*
|
||||
* @since 0.9.12
|
||||
*/
|
||||
@Override
|
||||
public void optionsUpdated(I2PTunnel tunnel) {
|
||||
if (getTunnel() != tunnel)
|
||||
return;
|
||||
Properties props = tunnel.getClientOptions();
|
||||
// see TunnelController.setSessionOptions()
|
||||
String proxies = props.getProperty("proxyList");
|
||||
if (proxies != null) {
|
||||
StringTokenizer tok = new StringTokenizer(proxies, ", ");
|
||||
synchronized(_proxyList) {
|
||||
_proxyList.clear();
|
||||
while (tok.hasMoreTokens())
|
||||
_proxyList.add(tok.nextToken().trim());
|
||||
}
|
||||
} else {
|
||||
synchronized(_proxyList) {
|
||||
_proxyList.clear();
|
||||
}
|
||||
}
|
||||
super.optionsUpdated(tunnel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 0.9.4
|
||||
*/
|
||||
|
@ -445,6 +445,10 @@ public class TunnelController implements Logging {
|
||||
String target = getTargetDestination();
|
||||
if (target != null)
|
||||
opts.setProperty("targetDestination", target);
|
||||
// Ditto outproxy list. Since 0.9.12.
|
||||
String proxies = getProxyList();
|
||||
if (proxies != null)
|
||||
opts.setProperty("proxyList", proxies);
|
||||
_tunnel.setClientOptions(opts);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user