Synchronize access to candidateSockets.get(). (#203)

* Synchronize access to candidateSockets.get().

* Remove XXX comment about synchronization.
This commit is contained in:
Jonathan Lennox 2021-09-17 16:48:45 -04:00 committed by GitHub
parent 9dc08bd299
commit d7c0e27a1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -379,7 +379,6 @@ public class SinglePortUdpHarvester
componentSocket.add(multiplexing); componentSocket.add(multiplexing);
} }
// XXX is this necessary?
synchronized (candidateSockets) synchronized (candidateSockets)
{ {
IceSocketWrapper oldSocket IceSocketWrapper oldSocket
@ -405,8 +404,10 @@ public class SinglePortUdpHarvester
protected IceSocketWrapper getCandidateIceSocketWrapper( protected IceSocketWrapper getCandidateIceSocketWrapper(
SocketAddress remoteAddress) SocketAddress remoteAddress)
{ {
return candidateSockets.get(remoteAddress); synchronized (candidateSockets)
{
return candidateSockets.get(remoteAddress);
}
} }
} }
} }