forked from Qortal/qortal
Added networking optimization, to avoid wasted processing on every read.
Thanks to @catbref for finding this.
This commit is contained in:
parent
b30445c5f8
commit
25efee55b8
@ -473,6 +473,7 @@ public class Peer {
|
||||
return;
|
||||
}
|
||||
|
||||
if (LOGGER.isTraceEnabled()) {
|
||||
if (bytesRead > 0) {
|
||||
byte[] leadingBytes = new byte[Math.min(bytesRead, 8)];
|
||||
this.byteBuffer.asReadOnlyBuffer().position(priorPosition).get(leadingBytes);
|
||||
@ -484,6 +485,7 @@ public class Peer {
|
||||
LOGGER.trace("[{}] Received {} bytes into byteBuffer[{}] from peer {}", this.peerConnectionId,
|
||||
bytesRead, priorPosition, this);
|
||||
}
|
||||
}
|
||||
final boolean wasByteBufferFull = !this.byteBuffer.hasRemaining();
|
||||
|
||||
while (true) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user