- int length = bb.getUnsignedShort(LENGTH_INDEX_IN_HEADER);
- if (bb.readableBytes() < length) {
- LOGGER.debug("skipping bb - too few data for msg: " +
- bb.readableBytes() + " < " + length);
+ int length = bb.getUnsignedShort(bb.readerIndex() + LENGTH_INDEX_IN_HEADER);
+ LOGGER.debug("length of actual message: {}", length);
+
+ if (readableBytes < length) {
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug("skipping bytebuf - too few bytes for msg: " +
+ readableBytes + " < " + length);
+ LOGGER.debug("bytebuffer: " + ByteBufUtils.byteBufToHexString(bb));
+ }