Browse Source

Protect sendHeartbeat from cancellation

Issue: SPR-14564
pull/1155/head
Rossen Stoyanchev 8 years ago
parent
commit
977b67e418
  1. 0
      change.diff
  2. 4
      spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractSockJsSession.java

0
change.diff

4
spring-websocket/src/main/java/org/springframework/web/socket/sockjs/transport/session/AbstractSockJsSession.java

@ -252,6 +252,10 @@ public abstract class AbstractSockJsSession implements SockJsSession { @@ -252,6 +252,10 @@ public abstract class AbstractSockJsSession implements SockJsSession {
if (isActive()) {
if (heartbeatLock.tryLock()) {
try {
if (this.heartbeatTask == null) {
// Cancelled while waiting to acquire the lock
return;
}
writeFrame(SockJsFrame.heartbeatFrame());
scheduleHeartbeat();
}

Loading…
Cancel
Save