mrozmanith / merapi

Automatically exported from code.google.com/p/merapi
0 stars 0 forks source link

Old messages are processed multiple times, due to a problem in message buffer management. #2

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Send a first message from Java to ActionScript.
2. In ActionScript, the message is received and processed.
3. Send another message from Java to ActionScript.
4. In ActionScript, both the first and new message are processed (even if 
the first one was already handled by the MessageHandler).

What is the expected output? What do you see instead?
Already processed messages should not be processed again.

IMO, the receive buffer is not being cleared after an entire messages has 
arrived. We should keep the buffer content (resetting the position to zero 
and appending new data to the end) only while we have only a partial 
message - and clear it on each fully received one.

Original issue reported on code.google.com by lukak...@gmail.com on 22 May 2009 at 4:30

GoogleCodeExporter commented 8 years ago
Fixed in [11]

Original comment by adamfla...@gmail.com on 27 May 2009 at 12:52

GoogleCodeExporter commented 8 years ago

Original comment by adamfla...@gmail.com on 4 Jun 2009 at 5:39

GoogleCodeExporter commented 8 years ago
Sorry, I hadn't time to check the committed fix. However i've compared the code 
with my 
own fix and it is the same, so i think that the bug has been fixed :) (my code 
has also 
the fix for the message lenght).

Original comment by lukak...@gmail.com on 4 Jun 2009 at 8:27

GoogleCodeExporter commented 8 years ago
Great.. could you submit your fix to merapi.patches@gmail.com? 

much appreciated,
-adam

Original comment by adamfla...@gmail.com on 4 Jun 2009 at 8:58

GoogleCodeExporter commented 8 years ago
The fix for the message length is quite "brute": for now I've used an 
Amf3Output 
class instance directly from the sendMessage(...) method... I think that a 
better way 
could be to use a cached Amf3Output (like the class used to encode the message, 
but 
now I don't remenber how it was).
Insteand, the use of Integer instead of Byte to send and read the message 
length is 
required, b/c the getByte() in ActionScript return a number that isn't big 
enough to 
fit a Java long type.
Tomorrow if I found some time I'll send the "brute" fix :).

Bye,
Luca

Original comment by lukak...@gmail.com on 4 Jun 2009 at 9:40