Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Packets reordered then TCP Window becomes full #26

Open
mcelrath opened this issue Mar 2, 2017 · 1 comment
Open

Packets reordered then TCP Window becomes full #26

mcelrath opened this issue Mar 2, 2017 · 1 comment

Comments

@mcelrath
Copy link

mcelrath commented Mar 2, 2017

When the TCP window specified by cordova-plugin-chrome-apps-sockets-tcp is full, the plugin incorrectly reorders packets. (Decreasing bufferSize causes this bug to be more easily triggered)

This is likely the cause of issue #14.

The following is my reassembly of a packet stream, in which the 3rd and 4th packets are fed to the client in the wrong order. The pipe symbol is the boundary between sequential data packets.

offset        0: ws                 |fabfb5da696e7600	 ds                 |fabfb5da696e7600
offset     1472: ws b1580a020000004f|314e67b3f9a2dab2	 ds b1580a020000004f|314e67b3f9a2dab2
offset     2920: ws bc2bdca8d063b8c3|2b4957c8f718dc39	 ds bc2bdca8d063b8c3|1b50bbb5a6613c6a
offset     4368: ws f9d3da5b4c28c34b|1b50bbb5a6613c6a	 ds 873eaffd178df798|2b4957c8f718dc39
offset     5816: ws 873eaffd178df798|8b3a9b2bcca36f02	 ds f9d3da5b4c28c34b|8b3a9b2bcca36f02
offset     7264: ws 292fc5406b7f0e02|0000002868810b07	 ds 292fc5406b7f0e02|0000002868810b07

The left side comes from wireshark, the packet trace I've uploaded here: https://github.com/VidaID/cordova-plugin-chrome-apps-sockets-tcp/blob/180-signverify/tcpreorder.pcapng.gz
The right side is the sequence of onReceive data events received by my app, using the chrome-net plugin.

The erroneous reorderings occur in frames 129 and 131 of the wireshark dump.

Any clue what's going on here?

@mcelrath
Copy link
Author

mcelrath commented Mar 2, 2017

This seems to be caused by calling readyToRead in the handler, which seems totally wrong to me -- the application hasn't even seen the data yet...

Anyway, removing the calls to readyToRead in the event handlers inside registerReceiveEvents at the end of sockets.tcp.js seems to fix the problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant