forked from I2P_Developers/i2p.i2p
Console: ConfigTunnels backend minor cleanup
This commit is contained in:
@@ -5,6 +5,7 @@ import java.util.Map;
|
||||
|
||||
import net.i2p.data.DataFormatException;
|
||||
import net.i2p.data.Hash;
|
||||
import net.i2p.router.TunnelManagerFacade;
|
||||
import net.i2p.router.TunnelPoolSettings;
|
||||
import net.i2p.router.web.FormHandler;
|
||||
import net.i2p.util.Log;
|
||||
@@ -38,6 +39,7 @@ public class ConfigTunnelsHandler extends FormHandler {
|
||||
*
|
||||
*/
|
||||
private void saveChanges() {
|
||||
TunnelManagerFacade mgr = _context.tunnelManager();
|
||||
boolean saveRequired = false;
|
||||
Map<String, String> changes = new HashMap<String, String>();
|
||||
|
||||
@@ -56,8 +58,8 @@ public class ConfigTunnelsHandler extends FormHandler {
|
||||
TunnelPoolSettings in = null;
|
||||
TunnelPoolSettings out = null;
|
||||
if ("exploratory".equals(poolName)) {
|
||||
in = _context.tunnelManager().getInboundSettings();
|
||||
out = _context.tunnelManager().getOutboundSettings();
|
||||
in = mgr.getInboundSettings();
|
||||
out = mgr.getOutboundSettings();
|
||||
} else {
|
||||
try {
|
||||
client.fromBase64(poolName);
|
||||
@@ -66,8 +68,8 @@ public class ConfigTunnelsHandler extends FormHandler {
|
||||
index++;
|
||||
continue;
|
||||
}
|
||||
in = _context.tunnelManager().getInboundSettings(client);
|
||||
out = _context.tunnelManager().getOutboundSettings(client);
|
||||
in = mgr.getInboundSettings(client);
|
||||
out = mgr.getOutboundSettings(client);
|
||||
}
|
||||
|
||||
if ( (in == null) || (out == null) ) {
|
||||
@@ -115,15 +117,15 @@ public class ConfigTunnelsHandler extends FormHandler {
|
||||
_log.debug("Inbound exploratory settings: " + in);
|
||||
_log.debug("Outbound exploratory settings: " + out);
|
||||
}
|
||||
_context.tunnelManager().setInboundSettings(in);
|
||||
_context.tunnelManager().setOutboundSettings(out);
|
||||
mgr.setInboundSettings(in);
|
||||
mgr.setOutboundSettings(out);
|
||||
} else {
|
||||
if (_log.shouldLog(Log.DEBUG)) {
|
||||
_log.debug("Inbound settings for " + client.toBase64() + ": " + in);
|
||||
_log.debug("Outbound settings for " + client.toBase64() + ": " + out);
|
||||
}
|
||||
_context.tunnelManager().setInboundSettings(client, in);
|
||||
_context.tunnelManager().setOutboundSettings(client, out);
|
||||
mgr.setInboundSettings(client, in);
|
||||
mgr.setOutboundSettings(client, out);
|
||||
}
|
||||
|
||||
updated++;
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Set;
|
||||
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.data.Destination;
|
||||
import net.i2p.router.TunnelManagerFacade;
|
||||
import net.i2p.router.TunnelPoolSettings;
|
||||
import net.i2p.router.transport.TransportUtil;
|
||||
import net.i2p.router.web.HelperBase;
|
||||
@@ -29,15 +30,16 @@ public class ConfigTunnelsHelper extends HelperBase {
|
||||
}
|
||||
|
||||
buf.append("<table id=\"tunnelconfig\">\n");
|
||||
TunnelPoolSettings exploratoryIn = _context.tunnelManager().getInboundSettings();
|
||||
TunnelPoolSettings exploratoryOut = _context.tunnelManager().getOutboundSettings();
|
||||
TunnelManagerFacade mgr = _context.tunnelManager();
|
||||
TunnelPoolSettings exploratoryIn = mgr.getInboundSettings();
|
||||
TunnelPoolSettings exploratoryOut = mgr.getOutboundSettings();
|
||||
|
||||
renderForm(buf, 0, "exploratory", _t("Exploratory tunnels"), exploratoryIn, exploratoryOut);
|
||||
|
||||
cur = 1;
|
||||
for (Destination dest : clients) {
|
||||
TunnelPoolSettings in = _context.tunnelManager().getInboundSettings(dest.calculateHash());
|
||||
TunnelPoolSettings out = _context.tunnelManager().getOutboundSettings(dest.calculateHash());
|
||||
TunnelPoolSettings in = mgr.getInboundSettings(dest.calculateHash());
|
||||
TunnelPoolSettings out = mgr.getOutboundSettings(dest.calculateHash());
|
||||
|
||||
if (in == null || in.getAliasOf() != null ||
|
||||
out == null || out.getAliasOf() != null) {
|
||||
|
||||
Reference in New Issue
Block a user