Permalink
Browse files

moved the copy of channel buffer to split since those are the buffers…

… we end up keeping
  • Loading branch information...
1 parent a348c20 commit dc4c16b4acfe601d376afd48bde3f31bcfbcfd77 Arya Asemanfar committed Mar 15, 2011
@@ -42,7 +42,7 @@ abstract class AbstractDecoder extends FrameDecoder {
if (frameLength < 0) {
needMoreData
} else {
- val frame = buffer.slice(buffer.readerIndex, frameLength).copy()
+ val frame = buffer.slice(buffer.readerIndex, frameLength)
buffer.skipBytes(frameLength + DELIMITER.capacity)
val tokens = frame.split(" ")
@@ -19,10 +19,10 @@ object ChannelBufferUtils {
val tokenLength = scratch.bytesBefore(stringToChannelBufferIndexFinder(delimiter))
if (tokenLength < 0) {
- tokens += scratch
+ tokens += scratch.copy
scratch = scratch.slice(0, 0)
} else {
- tokens += scratch.slice(0, tokenLength)
+ tokens += scratch.slice(0, tokenLength).copy
scratch = scratch.slice(tokenLength + skipDelimiter, scratch.capacity - tokenLength - skipDelimiter)
}
}

0 comments on commit dc4c16b

Please sign in to comment.