mirror of
https://gitlab.com/Monsterovich/lanemu.git
synced 2024-07-07 06:01:16 +02:00
Close a port via upnp when closing an application
This commit is contained in:
parent
b87208883e
commit
0c5d609700
|
@ -49,7 +49,7 @@ import org.p2pvpn.tools.ProfileManager;
|
|||
*
|
||||
* @author Wolfgang Ginolas
|
||||
*/
|
||||
public class MainControl implements ConnectorListener {
|
||||
public final class MainControl implements ConnectorListener {
|
||||
|
||||
private static final String DEFAULT_NET_FILE = "default.dat";
|
||||
|
||||
|
@ -105,6 +105,14 @@ public class MainControl implements ConnectorListener {
|
|||
popupChat = prefs.getBoolean("popupChat", false);
|
||||
theme = prefs.get("theme", "Light");
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
|
||||
public void run() {
|
||||
if (connectionManager != null &&
|
||||
connectionManager.getUPnPPortForward().getInitialized()) {
|
||||
connectionManager.getUPnPPortForward().close();
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
if (accessCfg == null) {
|
||||
loadDefaultNet();
|
||||
|
|
Loading…
Reference in a new issue