diff --git a/changelog.txt b/changelog.txt index 335fbda..7c618b6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ * On restart to update, will detect if a router requires admin rights to install and will ask the user to authorize the update. In user-mode, no prompt will ever be seen. + * Updates to the Firefox profiles to improve compatibility with more Firefoxes 2022-02-10 idk * This release fixes automatic update using Bittorrent within the I2P network diff --git a/java/net/i2p/router/WinLauncher.java b/java/net/i2p/router/WinLauncher.java index 61fe6c2..2f1f9f9 100644 --- a/java/net/i2p/router/WinLauncher.java +++ b/java/net/i2p/router/WinLauncher.java @@ -1,6 +1,8 @@ package net.i2p.router; import java.io.*; +import java.net.InetAddress; +import java.net.Socket; import java.util.*; import net.i2p.crypto.*; @@ -49,6 +51,12 @@ public class WinLauncher { System.out.println("\t" + System.getProperty("i2p.dir.base") + "\n\t" + System.getProperty("i2p.dir.config") + "\n\t" + System.getProperty("router.pid")); + // do a quick check to see of port 7657 is already occupied + if (i2pIsRunning()) { + System.err.println("I2P is already running"); + System.exit(0); + } + // wupp.i2pRouter = new Router(System.getProperties()); System.out.println("Router is configured"); @@ -61,6 +69,18 @@ public class WinLauncher { RouterLaunch.main(args); } + private static boolean i2pIsRunning() { + // check if there's something listening on port 7657 + try { + InetAddress localhost = InetAddress.getLocalHost(); + Socket s = new Socket(localhost, 7657); + s.close(); + return true; + } catch (IOException e) { + return false; + } + } + private static final Runnable REGISTER_UPP = () -> { // first wait for the RouterContext to appear