* Console:

- config.jsp now cause graceful restart
    * UPnP:
      - Tweak to help startup problems
   * UDP:
      - Only save IP when it changes
This commit is contained in:
zzz
2009-05-28 13:49:57 +00:00
parent 665b691711
commit 65ae9138ef
4 changed files with 29 additions and 15 deletions

View File

@ -215,16 +215,16 @@ public class ConfigNetHandler extends FormHandler {
if (switchRequired) {
_context.router().setConfigSetting(PROP_HIDDEN, "" + _hiddenMode);
if (_hiddenMode)
addFormNotice("Gracefully restarting into Hidden Router Mode. Make sure you have no 0-1 length "
+ "<a href=\"configtunnels.jsp\">tunnels!</a>");
addFormError("Gracefully restarting into Hidden Router Mode");
else
addFormNotice("Gracefully restarting to exit Hidden Router Mode");
addFormError("Gracefully restarting to exit Hidden Router Mode");
}
_context.router().setConfigSetting(Router.PROP_DYNAMIC_KEYS, "" + _dynamicKeys);
if (Boolean.valueOf(_context.getProperty(TransportManager.PROP_ENABLE_UPNP)).booleanValue() !=
_upnp) {
// This is minor, don't set restartRequired
if (_upnp)
addFormNotice("Enabling UPnP, restart required to take effect");
else
@ -240,9 +240,11 @@ public class ConfigNetHandler extends FormHandler {
}
// Time sync enable, means NOT disabled
_context.router().setConfigSetting(Timestamper.PROP_DISABLED, "false");
// Hmm router sets this at startup, not required here
//_context.router().setConfigSetting(Timestamper.PROP_DISABLED, "false");
LoadTestManager.setEnableLoadTesting(_context, _enableLoadTesting);
// Hidden in the GUI
//LoadTestManager.setEnableLoadTesting(_context, _enableLoadTesting);
}
boolean saved = _context.router().saveConfig();
@ -256,14 +258,24 @@ public class ConfigNetHandler extends FormHandler {
if (switchRequired) {
hiddenSwitch();
} else if (restartRequired) {
// Wow this dumps all conns immediately and really isn't nice
//addFormNotice("Performing a soft restart");
//_context.router().restart();
//addFormNotice("Soft restart complete");
// Most of the time we aren't changing addresses, just enabling or disabling
// things, so let's try just a new routerInfo and see how that works.
// Maybe we should restart if we change addresses though?
_context.router().rebuildRouterInfo();
addFormNotice("Router Info rebuilt");
// No, this doesn't work well, really need to call SSU Transport externalAddressReceived(),
// but that's hard to get to, and doesn't handle port changes, etc.
// So don't do this...
//_context.router().rebuildRouterInfo();
//addFormNotice("Router Info rebuilt");
// There's a few changes that don't really require restart (e.g. enabling inbound TCP)
// But it would be hard to get right, so just do a restart.
addFormError("Gracefully restarting I2P to change published router address");
_context.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
}
}

View File

@ -115,7 +115,7 @@
%>
<br />
<input type="radio" name="udpAutoIP" value="hidden" <%=nethelper.getUdpAutoIPChecked(2) %> />
Hidden mode - do not publish IP <i>(prevents participating traffic; change restarts router)</i><br />
Hidden mode - do not publish IP <i>(prevents participating traffic)</i><br />
</p><p>
<b>UDP Configuration:</b><br />
UDP port:
@ -142,7 +142,7 @@
<input type="radio" name="ntcpAutoIP" value="false" <%=nethelper.getTcpAutoIPChecked(0) %> />
Disable inbound (Firewalled)<br />
<input type="radio" name="ntcpAutoIP" value="disabled" <%=nethelper.getTcpAutoIPChecked(4) %> />
Completely disable <i>(select only if behind a firewall that throttles or blocks outbound TCP - change requires restart)</i><br />
Completely disable <i>(select only if behind a firewall that throttles or blocks outbound TCP)</i><br />
</p><p>
Externally reachable TCP port:<br />
<input type="radio" name="ntcpAutoPort" value="2" <%=nethelper.getTcpAutoPortChecked(2) %> />
@ -151,8 +151,7 @@
<input type="radio" name="ntcpAutoPort" value="1" <%=nethelper.getTcpAutoPortChecked(1) %> />
Specify Port:
<input name ="ntcpport" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="ntcpport" />" /><br />
</p><p><b>Note: changing any of these settings will terminate all of your connections and effectively
restart your router.</b>
</p><p><b>Note: Changing these settings will restart your router.</b>
</p>
<input type="submit" name="save" value="Save changes" /> <input type="reset" value="Cancel" /><br />
<hr />

View File

@ -30,7 +30,7 @@ public class UPnPManager {
private RouterContext _context;
private UPnP _upnp;
private UPnPCallback _upnpCallback;
private boolean _isRunning;
private volatile boolean _isRunning;
private InetAddress _detectedAddress;
private TransportManager _manager;
/**

View File

@ -477,9 +477,12 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
// queue a country code lookup of the new IP
_context.commSystem().queueLookup(ourIP);
// store these for laptop-mode (change ident on restart... or every time... when IP changes)
_context.router().setConfigSetting(PROP_IP, _externalListenHost.getHostAddress());
_context.router().setConfigSetting(PROP_IP_CHANGE, "" + _context.clock().now());
_context.router().saveConfig();
String oldIP = _context.getProperty(PROP_IP);
if (!_externalListenHost.getHostAddress().equals(oldIP)) {
_context.router().setConfigSetting(PROP_IP, _externalListenHost.getHostAddress());
_context.router().setConfigSetting(PROP_IP_CHANGE, "" + _context.clock().now());
_context.router().saveConfig();
}
_context.router().rebuildRouterInfo();
}
_testEvent.forceRun();