Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ConcurrentModificationException when iterating through connection #922

Merged
merged 1 commit into from Aug 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/main/java/org/java_websocket/server/WebSocketServer.java
Expand Up @@ -279,7 +279,9 @@ public void stop() throws IOException , InterruptedException {
* @since 1.3.8
*/
public Collection<WebSocket> getConnections() {
return Collections.unmodifiableCollection( new ArrayList<WebSocket>(connections) );
synchronized (connections) {
return Collections.unmodifiableCollection( new ArrayList<WebSocket>(connections) );
}
}

public InetSocketAddress getAddress() {
Expand Down