commit c85eacd226eb207a24bbd8d90b08d91d32fc0554
parent 6bea8a3abd0b657cfabb55385ee77b1d4b3f8906
Author: Matthias Jaros <jaros@mailbox.org>
Date: Thu, 2 Jul 2026 19:39:40 +0200
Default timeout for close operation to 60 seconds
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/it_jaros/jscanner/App.java b/src/main/java/com/it_jaros/jscanner/App.java
@@ -27,7 +27,7 @@ public class App {
if (options == null) return;
try (Scanner scanner = new Scanner(options)) {
Scan scan = Scan.create(options);
- addShutdownHook(scanner, options);
+ addShutdownHook(scanner);
printScanResults(scanner.runScan(scan), scan.getPeakConcurrentConnects(), options.showFilteredPorts());
} finally {
shutdownLatch.countDown();
@@ -97,7 +97,7 @@ public class App {
*
* @param scanner
*/
- private static void addShutdownHook(Scanner scanner, ScanOptions options) {
+ private static void addShutdownHook(Scanner scanner) {
shutdownHook = new Thread(() -> {
System.err.printf("%nCtrl-C received. Shutting down... Waiting for timeout of %d seconds%n", shutdownTimeoutInMillis / 1000);
shutdown(scanner);
diff --git a/src/main/java/com/it_jaros/jscanner/Scanner.java b/src/main/java/com/it_jaros/jscanner/Scanner.java
@@ -243,7 +243,7 @@ public class Scanner implements AutoCloseable {
@Override
public void close() throws Exception {
cancel();
- awaitTermination(Duration.ofMillis(10000));
+ awaitTermination(Duration.ofMillis(60000));
}
public void awaitTermination(Duration duration) throws InterruptedException, TimeoutException {