Github user clockfly commented on a diff in the pull request:

    https://github.com/apache/incubator-storm/pull/103#discussion_r12362595
  
    --- Diff: 
storm-core/src/jvm/backtype/storm/messaging/netty/MessageDecoder.java ---
    @@ -34,52 +37,78 @@
          */
         protected Object decode(ChannelHandlerContext ctx, Channel channel, 
ChannelBuffer buf) throws Exception {
             // Make sure that we have received at least a short 
    -        if (buf.readableBytes() < 2) {
    +        long available = buf.readableBytes();
    +        if (available < 2) {
                 //need more data
                 return null;
             }
     
    -        // Mark the current buffer position before reading task/len field
    -        // because the whole frame might not be in the buffer yet.
    -        // We will reset the buffer position to the marked position if
    -        // there's not enough bytes in the buffer.
    -        buf.markReaderIndex();
    -
    -        //read the short field
    -        short code = buf.readShort();
    -        
    -        //case 1: Control message
    -        ControlMessage ctrl_msg = ControlMessage.mkMessage(code);
    -        if (ctrl_msg != null) return ctrl_msg;
    -        
    -        //case 2: task Message
    -        short task = code;
    -        
    -        // Make sure that we have received at least an integer (length) 
    -        if (buf.readableBytes() < 4) {
    -            //need more data
    -            buf.resetReaderIndex();
    -            return null;
    -        }
    +        List<Object> ret = new ArrayList<Object>();
    +
    +        while (available >= 2) {
    --- End diff --
    
    while loop, try to decode as more messages as possible.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to