Le 14/07/16 à 10:47, Alexander Christian a écrit :
> Continued the search. Had a intensive look at my encoder class
> de.root1.simon.codec.base.AbstractMessageEncoder.
>
> You recommended checking the buffer and to ensure it is cleared... The
> used buffer is created every time from scratch. So it's a new buffer,
> everytime.
>
> I observed the buffer which is beeing sent. Looks like the data which
> is sent is always okay.
>
> On receiving side (exception complains about decoding...) it seems
> that the begin of a message is somewhen not correctly determined, but
> only if
>
> a) cpu ist fast enough (I'm not able to reproduce it on my rather slow
> home server (AMD 2x1,6Ghz)
> b) logging does not slow down too much
>
> The "no appropriate message decoder" message show a big amount of
> bytes. When analyzing them, it seems that it contains multiple
> messages, but beginning somewhere in the middle of a message.
>
> Feels like I'm getting closer.

The decoder wil try to decode as many messages as there ae in the buffer
(ie, you ay have more than one message in the read buffer - and of
course you can have less than one message, but in this case, the
isDecodable() will return false, and the buffer will be completed later -.

For every read, the decoder will try to decode a message, and if it
succeed, a messageReceived event will be propagated up to the IoHandler.
It will then iterate until it can't decode a message, processing the
buffer forward. At some point, the decoder can prefectly be in the
middle of the buffer, but still at the correct position, ie at the
beginnig of a second message. Here, this seems not to be the case.

Reply via email to