Skip to content

Commit

Permalink
moved the copy of channel buffer to split since those are the buffers…
Browse files Browse the repository at this point in the history
… we end up keeping
  • Loading branch information
Arya Asemanfar committed Mar 15, 2011
1 parent a348c20 commit dc4c16b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -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(" ")
Expand Down
Expand Up @@ -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)
}
}
Expand Down

0 comments on commit dc4c16b

Please sign in to comment.