aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-06-28 15:25:08 +0300
committerGravatar Vitaly Takmazov2016-06-28 15:25:08 +0300
commitc4948c141a68433b4ba9eca167622816dcd10fa1 (patch)
treef8776814b304768e2b2db83403def7ce55a34b6a /src/main/java/com
parent2d89e7882c09be7cbe82a4e5df09c23ab106be20 (diff)
fix session closing
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/juick/ws/WebsocketComponent.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/com/juick/ws/WebsocketComponent.java b/src/main/java/com/juick/ws/WebsocketComponent.java
index 7399c298..8ccccb3b 100644
--- a/src/main/java/com/juick/ws/WebsocketComponent.java
+++ b/src/main/java/com/juick/ws/WebsocketComponent.java
@@ -103,9 +103,12 @@ public class WebsocketComponent extends TextWebSocketHandler {
@Override
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception {
synchronized (clients) {
- clients.stream().filter(c -> c.session.getId().equals(session.getId())).forEach(c -> {
- logger.info(String.format("session %s closed with status %s", c.clientName, status.getCode()));
- clients.remove(c);
+ clients.removeIf(c -> {
+ if (c.session.equals(session)) {
+ logger.info(String.format("session from %s closed with status %d", c.clientName, status.getCode()));
+ return true;
+ }
+ return false;
});
}