Closed mrandreastoth closed 6 months ago
The following is the edited output from a test run with six (6) clients where I rapidly click on both the "Send to clients" and "Send from clients" buttons. Note the client messages flagged as CORRUPT...
Server created Client0 created Client1 created Client2 created Client3 created Client4 created Client5 created ServerClient0 created ServerClient1 created ServerClient2 created ServerClient3 created ServerClient4 created ServerClient5 created ... Client0 sent data to Server (Data =
) Client1 sent data to Server (Data = ) Client2 sent data to Server (Data = ) Client3 sent data to Server (Data = ) Client4 sent data to Server (Data = ) Client5 sent data to Server (Data = ) Server received data from Client0 (Data = ) Client0 sent data to Server (Data = ) Client1 sent data to Server (Data = ) Client2 sent data to Server (Data = ) Client3 sent data to Server (Data = ) Client4 sent data to Server (Data = ) Client5 sent data to Server (Data = ) Server received data from Client1 (Data = ) Server received data from Client2 (Data = ) <<< CORRUPT >>> Server received data from Client3 (Data = ) <<< CORRUPT >>> Server received data from Client4 (Data = ) <<< CORRUPT >>> Server received data from Client5 (Data = ) <<< CORRUPT >>> Server received data from Client0 (Data = ) Server received data from Client1 (Data = ) ...
The latest commit to my fork, i.e., 8bb318f, resolves the issue. However, it doesn't seem right. Surely the read buffer should be flushed on each read instead of being appended to even if multiple reads occur to Readable???
Hi there, sorry for such a late reply. The buffer DOES NOT change length every time you may be in the OnHandle event. This is for PERFORMANCE. In order to get the byte count you have received, you have to see the parameter giving you the Count.
Commit 50205fcf0e691853027db437d6d04fa65b504497 introduces a simple manual client/server test program.
Issue
The test program fails when executing client sends in rapid succession, i.e., when hitting "Send from clients" multiple times in a row in which case some received messages appear as containing duplicated strings of the original message.
Steps to reproduce
Observed behaviour
Some messages are flagged as CORRUPT. On inspecting any of these messages it can be seen that the reason for the message having been flagged is that the original message string has been repeated within the same message.
Expected behaviour
No messages are flagged as CORRUPT.
Note
This issue may be related to #20.