make the java launcher handle the Firefox launch automatically if the router is already running

This commit is contained in:
idk
2022-08-07 21:58:57 -04:00
parent cead2e1133
commit 3930c6750d
4 changed files with 19 additions and 15 deletions

View File

@ -10,8 +10,8 @@ VERSIONMINOR=8
VERSIONBUILD=1
I2P_VERSION="$VERSIONMAJOR.$VERSIONMINOR.$VERSIONBUILD"
export I2P_VERSION="$VERSIONMAJOR.$VERSIONMINOR.$VERSIONBUILD"
VERSION=i2p-1.8.1
export VERSION=i2p-1.8.1
VERSION=i2p-1.8.8
export VERSION=i2p-1.8.0
#Uncomment this to build from the tip of the master.
#I2P_VERSION=1.8.0

View File

@ -2,6 +2,7 @@ package net.i2p.router;
import java.io.*;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.*;
import java.util.logging.FileHandler;
@ -92,15 +93,21 @@ public class WinLauncher {
RouterLaunch.main(args);
}
// see https://stackoverflow.com/questions/434718/sockets-discover-port-availability-using-java
public static boolean isAvailable(int portNr) {
boolean portFree;
try (var ignored = new ServerSocket(portNr)) {
portFree = true;
} catch (IOException e) {
portFree = false;
}
return portFree;
}
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();
if (!isAvailable(7657)) {
return true;
} catch (IOException e) {
return false;
}
// check for the existence of router.ping file, if it's less then 2 minutes old,
// exit
@ -113,6 +120,7 @@ public class WinLauncher {
return true;
}
}
return false;
}
private static final Runnable REGISTER_UPP = () -> {

View File

@ -212,10 +212,6 @@ Applications:
Copyright (c) 2006, Matthew Estes
See licenses/LICENSE-BlockFile.txt
BOB (BOB.jar):
Copyright (C) sponge
See licenses/COPYING-BOB.txt
Desktopgui (desktopgui.jar):
Copyright (c) Mathias De Maré
See licenses/LICENSE-DesktopGUI.txt
@ -339,9 +335,9 @@ Applications:
Systray (systray.jar):
Public domain.
Tomcat 9.0.54 (jasper-runtime.jar):
Tomcat 9.0.62 (jasper-runtime.jar):
(not included in most distribution packages)
Copyright 1999-2021 The Apache Software Foundation
Copyright 1999-2022 The Apache Software Foundation
See licenses/LICENSE-Apache2.0.txt
See licenses/NOTICE-Tomcat.txt

View File

@ -1,5 +1,5 @@
Apache Tomcat
Copyright 1999-2021 The Apache Software Foundation
Copyright 1999-2022 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (https://www.apache.org/).