Closed slovdahl closed 7 years ago
I'll push a disabled unit test that verifies this as soon as I'm ready with it.
@slovdahl Any update?
I haven't been able to write a test that reproduces the behaviour and I haven't had enough time to try to learn how to. I'll try to find some time soon.
Finally got around to writing a test for this. I wasn't able to run any other tests in the suite and I had to use a newer version of testng (6.x) locally to even execute these ones in IntelliJ.
FYI, it works with 2.1.0. And this is the commit that broke it: https://github.com/Atmosphere/wasync/commit/9114ef32842433478b32c52b297fef4a6c133681
Noticed this when updating from wAsync 1.4.3 to 2.1.2.
If multiple messages are delivered at the same time, which eg. happens when more than one message is cached by Atmosphere and delivered to a long-polling connection after it reconnects, only the first one is delivered to the Function<?> for Event.MESSAGE.
The cause of this seems to be that lines 175-177 in TranportsUtil are executed after the TrackMessageSizeDecoder has been executed:
In this case the
l
variable contains the decoded messages, and should be used instead ofdecodedObjects
, which at this point always seems to be empty.The reason it worked with earlier versions (eg. 1.4.3) is that the if statement on line 171 in TransportsUtil,
nd.isEmpty()
, was true unless any custom decoders had been added. AfterPaddingAndHeartbeatDecoder
was added the statement will never be true any more, and that's probably when the bug started occuring.