From d7c0e27a1cde7b877b34d8bb68dc39f18dc45f16 Mon Sep 17 00:00:00 2001 From: Jonathan Lennox Date: Fri, 17 Sep 2021 16:48:45 -0400 Subject: [PATCH] Synchronize access to candidateSockets.get(). (#203) * Synchronize access to candidateSockets.get(). * Remove XXX comment about synchronization. --- .../java/org/ice4j/ice/harvest/SinglePortUdpHarvester.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/ice4j/ice/harvest/SinglePortUdpHarvester.java b/src/main/java/org/ice4j/ice/harvest/SinglePortUdpHarvester.java index 50ed6a9..a99b8ae 100644 --- a/src/main/java/org/ice4j/ice/harvest/SinglePortUdpHarvester.java +++ b/src/main/java/org/ice4j/ice/harvest/SinglePortUdpHarvester.java @@ -379,7 +379,6 @@ public class SinglePortUdpHarvester componentSocket.add(multiplexing); } - // XXX is this necessary? synchronized (candidateSockets) { IceSocketWrapper oldSocket @@ -405,8 +404,10 @@ public class SinglePortUdpHarvester protected IceSocketWrapper getCandidateIceSocketWrapper( SocketAddress remoteAddress) { - return candidateSockets.get(remoteAddress); + synchronized (candidateSockets) + { + return candidateSockets.get(remoteAddress); + } } - } }