Transport: Better message on UPnP tab when enabled but fails to start (Github #84)

This commit is contained in:
zzz
2024-11-29 10:50:54 -05:00
parent 37cdade492
commit 085bbbb6e6

View File

@@ -141,11 +141,11 @@ class UPnPManager {
// If not, that's why it failed (HTTPServer won't start) // If not, that's why it failed (HTTPServer won't start)
if (!Addresses.isConnected()) { if (!Addresses.isConnected()) {
if (!_disconLogged) { if (!_disconLogged) {
_log.logAlways(Log.WARN, "UPnP start failed - no network connection?"); _log.logAlways(Log.WARN, _t("UPnP failed to start - no network connection?"));
_disconLogged = true; _disconLogged = true;
} }
} else { } else {
_log.error("UPnP start failed - port conflict?"); _log.error(_t("UPnP failed to start - port conflict?"));
} }
} }
} }
@@ -391,8 +391,14 @@ class UPnPManager {
* will take many seconds if it has vanished. * will take many seconds if it has vanished.
*/ */
public String renderStatusHTML() { public String renderStatusHTML() {
if (!_isRunning) if (!_isRunning) {
return "<h3><a name=\"upnp\"></a>" + _t("UPnP is not enabled") + "</h3>\n"; String msg;
if (Addresses.isConnected())
msg = _t("UPnP failed to start - port conflict?");
else
msg = _t("UPnP failed to start - no network connection?");
return "<h3><a name=\"upnp\"></a>" + msg + "</h3>\n";
}
return _upnp.renderStatusHTML(); return _upnp.renderStatusHTML();
} }