}
// Increment incoming packet sequence number
seqi = (seqi + 1) & 0xffffffffL;
// Get padding
byte pad = decoderBuffer.getByte();
Buffer buf;
int wpos = decoderBuffer.wpos();
// Decompress if needed
if (inCompression != null && (authed || !inCompression.isDelayed())) {
if (uncompressBuffer == null) {
uncompressBuffer = new Buffer();
} else {
uncompressBuffer.clear();
}
decoderBuffer.wpos(decoderBuffer.rpos() + decoderLength - 1 - pad);
inCompression.uncompress(decoderBuffer, uncompressBuffer);
buf = uncompressBuffer;
} else {
decoderBuffer.wpos(decoderLength + 4 - pad);
buf = decoderBuffer;
}
if (log.isTraceEnabled()) {
log.trace("Received packet #{}: {}", seqi, buf.printHex());
}
// Update stats
inPackets ++;
inBytes += buf.available();
// Process decoded packet
handleMessage(buf);
// Set ready to handle next packet
decoderBuffer.rpos(decoderLength + 4 + macSize);
decoderBuffer.wpos(wpos);