Trustin,

Now that you mention it, how does MINA decide _when_ to call decodable()?

For example, on the HTTP codec example, I see that you actually try to see
the tail of the buffer as it was passed to the decodable() function. So
decodable() will be called when a line end is encountered? (don't think so
=o)

Please clarify.

Thanks,
Rodrigo

On 3/21/07, Coding Horse <[EMAIL PROTECTED]> wrote:


Once understood, this design is really a beauty to me!  Thx to mina again!


Trustin Lee wrote:
>
> Hi,
>
> On 3/21/07, Coding Horse <[EMAIL PROTECTED]> wrote:
>>
>> Hi, Trustin,
>>
>> I really appreciate your wonderful explanation!  Could you also shed
some
>> light on this case when you have time:
>>
>> When decodable() is called there are 3.5 complete packets of MyPacket,
my
>> decode() implementation will take out each complete MyPacket and leave
>> the
>> remaining untouched to wait for more data.  In my previous post I said
I
>> just took out exact one MyPacket and return OK - I didn't care how many
>> MyPacket are inside current buffer as long as it contains at least one
>> complete MyPacket.  It seems to work for me because I found inside
>> decodable() the buffer position was adjusted automatically by one
>> MyPacket
>> after I "get" one MyPacket out in decode().  I just want to know if
this
>> is
>> the recommended way to achieve what I expected.
>
> Yes, it's the recommended way.  Please decode one message at once in
> decode() implementation.  MINA will call decodable() and decode()
> again if there's more to decode.
>
> HTH,
> Trustin
> --
> what we call human nature is actually human habit
> --
> http://gleamynode.net/
> --
> PGP Key ID: 0x0255ECA6
>
>

--
View this message in context:
http://www.nabble.com/A-question-about-implementing-MessageDecoder-tf3422797.html#a9586609
Sent from the mina dev mailing list archive at Nabble.com.


Reply via email to