Let the OS close the descriptors

This commit is contained in:
Nikolay Borodin 2024-03-28 21:01:10 +02:00
parent a7fa3fdf98
commit 3010a90af5

View file

@ -62,13 +62,14 @@ public class VPNConnector implements Runnable {
tuntap = TunTap.createTunTap();
router = null;
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
public void run() {
if (tuntap != null) {
tuntap.close();
}
}
}));
// fixme: Oracle JVM crashes when executing this code (OpenJDK works fine)
// Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
// public void run() {
// if (tuntap != null) {
// tuntap.close();
// }
// }
// }));
thread = new Thread(this, "VPNConnector");
thread.start();