Bug with DelimiterBasedFrameDecoder + Delimiters.nulDelimiter() or I am doing it wrong?
NicolasDesy
liguorien at hotmail.com
Wed Jul 29 18:20:14 EDT 2009
Hello all,
First of all, I'm quite new to Netty. I have used to create a small adobe
policy file server and that's about it.
I'm currently working on an app based on master/slaves model. I decided to
use netty for the communication between the master and the slaves.
I have currently the following pipelineFactory on the master :
public ChannelPipeline getPipeline() {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("decoder",
new DelimiterBasedFrameDecoder(1024,
Delimiters.nulDelimiter()));
pipeline.addLast("handler",
new MasterHandler());
return pipeline;
}
On the client side, I send a version request to the server to be sure the
master and the slave are using the same build. The request consist of 5
byte. An integer which represents the command ID and the a null(0) byte.
I looked a little bit a the source and it seems like the decoder considers
that every single messages contain a null byte because it invokes the
unfoldAndFireMessageReceived() every time it received a "messageReceived"
event. Which result in my handler receiving the "messageReceived" event
everytime even if the current message has not been fully received yet.
I changed my code to use a custom delimiter instead of
Delimiters.nulDelimiter() and now it works fine.
Is it a bug or I am doing something wrong?
Thanks in advance,
Nicolas
--
View this message in context: http://n2.nabble.com/Bug-with-DelimiterBasedFrameDecoder-%2B-Delimiters.nulDelimiter%28%29-or-I-am-doing-it-wrong--tp3353009p3353009.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list