Skip to content

Commit cfdb683

Browse files
committed
Call resetRequest after writeFrame for polling sessions
Previous refactoring (fcf6ae and also 43d937) in the SockJsSession hierarchy consolidated access to the request and response in the base class AbstractHttpSockJsSession in order to keep synchronization concerns there. However that also unintentionally removed the call to resetRequest() after sending a heartbeat for any of the PollingSockJsSession classes. In general a polling session should call resetRequest after every frame written. This commit brings back the writeFrame override in PollingSockJsSession with an extra call to resetRequest(). Issue: SPR-14107
1 parent 6c0cae8 commit cfdb683

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -58,7 +58,6 @@ protected void handleRequestInternal(ServerHttpRequest request, ServerHttpRespon
5858

5959
if (initialRequest) {
6060
writeFrame(SockJsFrame.openFrame());
61-
resetRequest();
6261
}
6362
else if (!getMessageCache().isEmpty()) {
6463
flushCache();
@@ -77,6 +76,11 @@ protected void flushCache() throws SockJsTransportFailureException {
7776
SockJsMessageCodec messageCodec = getSockJsServiceConfig().getMessageCodec();
7877
SockJsFrame frame = SockJsFrame.messageFrame(messageCodec, messages);
7978
writeFrame(frame);
79+
}
80+
81+
@Override
82+
protected void writeFrame(SockJsFrame frame) throws SockJsTransportFailureException {
83+
super.writeFrame(frame);
8084
resetRequest();
8185
}
8286

0 commit comments

Comments
 (0)