Browse Source

Include running total in "Sent X bytes" log entry.

qdn
CalDescent 3 years ago
parent
commit
aafb9d7e4f
  1. 6
      src/main/java/org/qortal/network/Peer.java

6
src/main/java/org/qortal/network/Peer.java

@ -553,12 +553,14 @@ public class Peer {
synchronized (this.socketChannel) { synchronized (this.socketChannel) {
final long sendStart = System.currentTimeMillis(); final long sendStart = System.currentTimeMillis();
long totalBytes = 0;
while (outputBuffer.hasRemaining()) { while (outputBuffer.hasRemaining()) {
int bytesWritten = this.socketChannel.write(outputBuffer); int bytesWritten = this.socketChannel.write(outputBuffer);
totalBytes += bytesWritten;
LOGGER.trace("[{}] Sent {} bytes of {} message with ID {} to peer {}", this.peerConnectionId, LOGGER.trace("[{}] Sent {} bytes of {} message with ID {} to peer {} ({} total)", this.peerConnectionId,
bytesWritten, message.getType().name(), message.getId(), this); bytesWritten, message.getType().name(), message.getId(), this, totalBytes);
if (bytesWritten == 0) { if (bytesWritten == 0) {
// Underlying socket's internal buffer probably full, // Underlying socket's internal buffer probably full,

Loading…
Cancel
Save