From 085bbbb6e6b5945c99a3ffec98c9a4d2a375d6f1 Mon Sep 17 00:00:00 2001 From: zzz Date: Fri, 29 Nov 2024 10:50:54 -0500 Subject: [PATCH] Transport: Better message on UPnP tab when enabled but fails to start (Github #84) --- .../src/net/i2p/router/transport/UPnPManager.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/router/java/src/net/i2p/router/transport/UPnPManager.java b/router/java/src/net/i2p/router/transport/UPnPManager.java index c3d662cc14..9a303f18d1 100644 --- a/router/java/src/net/i2p/router/transport/UPnPManager.java +++ b/router/java/src/net/i2p/router/transport/UPnPManager.java @@ -141,11 +141,11 @@ public synchronized void start() { // If not, that's why it failed (HTTPServer won't start) if (!Addresses.isConnected()) { 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; } } else { - _log.error("UPnP start failed - port conflict?"); + _log.error(_t("UPnP failed to start - port conflict?")); } } } @@ -391,8 +391,14 @@ private void locked_PFS(Map statuses) { * will take many seconds if it has vanished. */ public String renderStatusHTML() { - if (!_isRunning) - return "

" + _t("UPnP is not enabled") + "

\n"; + if (!_isRunning) { + String msg; + if (Addresses.isConnected()) + msg = _t("UPnP failed to start - port conflict?"); + else + msg = _t("UPnP failed to start - no network connection?"); + return "

" + msg + "

\n"; + } return _upnp.renderStatusHTML(); }