mirror of
https://gitlab.com/Monsterovich/lanemu.git
synced 2024-07-07 06:01:16 +02:00
Close tap device on exit
This commit is contained in:
parent
916e67e06a
commit
cda8fd684b
|
@ -20,6 +20,7 @@
|
|||
package org.p2pvpn.network;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.lang.Runtime;
|
||||
import org.p2pvpn.tuntap.TunTap;
|
||||
|
||||
/**
|
||||
|
@ -61,6 +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();
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
thread = new Thread(this, "VPNConnector");
|
||||
thread.start();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue