Consistently close connection after ERROR frame

Closes gh-23039
This commit is contained in:
Rossen Stoyanchev 2019-06-03 16:22:43 -04:00
parent 4f05da7fed
commit d2ec876f57
1 changed files with 8 additions and 2 deletions

View File

@ -329,12 +329,10 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
sendErrorMessage(session, ex);
return;
}
Message<byte[]> message = getErrorHandler().handleClientMessageProcessingError(clientMessage, ex);
if (message == null) {
return;
}
StompHeaderAccessor accessor = MessageHeaderAccessor.getAccessor(message, StompHeaderAccessor.class);
Assert.state(accessor != null, "No StompHeaderAccessor");
sendToClient(session, accessor, message.getPayload());
@ -357,6 +355,14 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
// Could be part of normal workflow (e.g. browser tab closed)
logger.debug("Failed to send STOMP ERROR to client", ex);
}
finally {
try {
session.close(CloseStatus.PROTOCOL_ERROR);
}
catch (IOException ex) {
// Ignore
}
}
}
private boolean detectImmutableMessageInterceptor(MessageChannel channel) {