Fix inverted logic for boolean last flag in JettyWebSocketSession when sending binary message#36650
Fix inverted logic for boolean last flag in JettyWebSocketSession when sending binary message#36650mguiking wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Hi, nice catch on the inverted logic here - by changing it to !iteratior.hasNext() flips the logic so the final buffer signals the end of the message (FIN = 1). Without this the last buffer was signalling more data was to come. Maybe adding a test case can help prove the fix works.
|
I noticed there isn't a dedicated unit test for this webflux module yet maybe adding it to the existing WebSocketIntegrationTests.java or creating a new JettyWebSocketSessionTests in the adapter folder? |
DhruvTheDev1
left a comment
There was a problem hiding this comment.
Hi, the tests look solid - checking for the false, false, true sequence proves the logic flip is correct for the fragmented messages. Looks good to me!
Signed-off-by: Max Guiking <[email protected]> Signed-off-by: Max Guiking <[email protected]>
… handling Signed-off-by: Max Guiking <[email protected]>
See spring-projectsgh-36650 Signed-off-by: Max Guiking <[email protected]>
sendPartialBinary'slastparameter controls the WebSocket FIN bit — true means "this is the final fragment." Spring sets it toiterator.hasNext()which is inverted: for a single-buffer binary message, last becomes false, so Jetty leaves the connection in a fragmented state (FIN=0). The next send (e.g. a text message) then fails.