From e4ba1b9e6c815eaeccfe0cf7473bce7d3ff16b21 Mon Sep 17 00:00:00 2001 From: Brutus5000 Date: Sun, 19 Nov 2023 22:58:21 +0100 Subject: [PATCH] Free the ice4j agent before recreating a new one Since the old agent might not be shutdown and garbage collected immediately, there might be some Stun-related resource blocked. --- .../main/java/com/faforever/iceadapter/ice/PeerIceModule.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ice-adapter/src/main/java/com/faforever/iceadapter/ice/PeerIceModule.java b/ice-adapter/src/main/java/com/faforever/iceadapter/ice/PeerIceModule.java index db1dd13..c2dea73 100644 --- a/ice-adapter/src/main/java/com/faforever/iceadapter/ice/PeerIceModule.java +++ b/ice-adapter/src/main/java/com/faforever/iceadapter/ice/PeerIceModule.java @@ -91,6 +91,10 @@ synchronized void initiateIce() { * Creates an agent and media stream for handling the ICE */ private void createAgent() { + if(agent != null) { + agent.free(); + } + agent = new Agent(); agent.setControlling(peer.isLocalOffer());