zhaopuming / quickfast

Automatically exported from code.google.com/p/quickfast
Other
1 stars 0 forks source link

Recovery after decoding exception (MessagePerPacketAssembler) #55

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Receive a message that generates a decoding exception
2. The exception is managed by consumeBuffer
3. The message buffer still contains undecoded bytes

What is the expected output? What do you see instead?
A buffer cleanup is expected after exception instead a number of decoding 
exception are reported for other messages until buffer realignment.

What version of the product are you using (svn Rev # or download package
version #)? On what operating system?
Behavior from 1.2  on MSVC9 + boost 1.42 

Please provide any additional information below.

This our clean up implementation in 
MessagePerPacketAssembler::consumeBuffer
  ...
  catch (const std::exception &ex)
  {
    result = builder_.reportDecodingError(ex.what());
    // message buffer clean up after decoding exception
    uchar byte;
    while(getByte(byte)); 
  }
  ...
This will immediately recover the decoding process thus eliminating 
(possible) false exceptions 

Original issue reported on code.google.com by fspagnol...@gmail.com on 27 May 2010 at 6:59

GoogleCodeExporter commented 9 years ago
Your work around is correct, but there is an even better way to solve this.  I 
recently 
added DataSource::reset() to discard any unconsumed information in the data 
source.   

I've added the necessary reset calls to MessagePerPacketAssembler in Revision 
420.

Thanks,

Dale

Original comment by dale.wil...@gmail.com on 27 May 2010 at 3:34