@ -40,7 +40,6 @@ class ByteBufferMessageSet(private val buffer: ByteBuffer,
@@ -40,7 +40,6 @@ class ByteBufferMessageSet(private val buffer: ByteBuffer,
@ -58,9 +57,9 @@ class ByteBufferMessageSet(private val buffer: ByteBuffer,
@@ -58,9 +57,9 @@ class ByteBufferMessageSet(private val buffer: ByteBuffer,
defserialized():ByteBuffer=buffer
defvalidBytes:Long=deepValidBytes
defshallowValidBytes:Long={
defvalidBytes:Long=shallowValidBytes
privatedefshallowValidBytes:Long={
if(shallowValidByteCount<0){
valiter=deepIterator
while(iter.hasNext){
@ -68,18 +67,10 @@ class ByteBufferMessageSet(private val buffer: ByteBuffer,
@@ -68,18 +67,10 @@ class ByteBufferMessageSet(private val buffer: ByteBuffer,
shallowValidByteCount=messageAndOffset.offset
}
}
shallowValidByteCount-initialOffset
if(shallowValidByteCount<initialOffset)0
else(shallowValidByteCount-initialOffset)
}
defdeepValidBytes:Long={
if(deepValidByteCount<0){
valiter=deepIterator
while(iter.hasNext)
iter.next
}
deepValidByteCount
}
/** Write the messages in this set to the given channel */
@ -98,7 +89,6 @@ class ByteBufferMessageSet(private val buffer: ByteBuffer,
@@ -98,7 +89,6 @@ class ByteBufferMessageSet(private val buffer: ByteBuffer,
defmakeNextOuter:MessageAndOffset={
if(topIter.remaining<4){
deepValidByteCount=currValidBytes
returnallDone()
}
valsize=topIter.getInt()
@ -109,7 +99,6 @@ class ByteBufferMessageSet(private val buffer: ByteBuffer,
@@ -109,7 +99,6 @@ class ByteBufferMessageSet(private val buffer: ByteBuffer,
logger.trace("size of data = "+size)
}
if(size<0||topIter.remaining<size){
deepValidByteCount=currValidBytes
if(currValidBytes==0||size<0)
thrownewInvalidMessageSizeException("invalid message size: "+size+" only received bytes: "+
topIter.remaining+" at "+currValidBytes+"( possible causes (1) a single message larger than "+