Issue #3106 - WebSocketConnectionStats changes from review

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2019-02-28 18:36:24 +11:00 committed by lachan-roberts
parent 46c2941a82
commit 6094b3802f
2 changed files with 11 additions and 6 deletions

View File

@ -162,8 +162,7 @@ public class FrameFlusher extends IteratingCallback
break; break;
} }
if(entry.frame.isFin()) messagesOut.increment();
messagesOut.increment();
int batchSpace = batchBuffer == null?bufferSize:BufferUtil.space(batchBuffer); int batchSpace = batchBuffer == null?bufferSize:BufferUtil.space(batchBuffer);
@ -230,9 +229,16 @@ public class FrameFlusher extends IteratingCallback
if (flush) if (flush)
{ {
int i = 0;
int bytes = 0;
ByteBuffer bufferArray[] = new ByteBuffer[buffers.size()];
for (ByteBuffer bb : buffers) for (ByteBuffer bb : buffers)
bytesOut.add(bb.limit() - bb.position()); {
endPoint.write(this, buffers.toArray(new ByteBuffer[buffers.size()])); bytes += bb.limit() - bb.position();
bufferArray[i++] = bb;
}
bytesOut.add(bytes);
endPoint.write(this, bufferArray);
buffers.clear(); buffers.clear();
} }
else else

View File

@ -402,8 +402,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
if (frame == null) if (frame == null)
break; break;
if (frame.isFin()) messagesIn.increment();
messagesIn.increment();
if (meetDemand()) if (meetDemand())
onFrame(frame); onFrame(frame);