Author: toad
Date: 2008-02-28 17:08:22 +0000 (Thu, 28 Feb 2008)
New Revision: 18209
Modified:
trunk/freenet/src/freenet/io/xfer/PacketThrottle.java
Log:
Logging
Modified: trunk/freenet/src/freenet/io/xfer/PacketThrottle.java
===================================================================
--- trunk/freenet/src/freenet/io/xfer/PacketThrottle.java 2008-02-28
16:50:11 UTC (rev 18208)
+++ trunk/freenet/src/freenet/io/xfer/PacketThrottle.java 2008-02-28
17:08:22 UTC (rev 18209)
@@ -54,6 +54,7 @@
private long _packetSeqWindowFull;
/** Last time (seqno) we checked whether the window was full, or
dropped a packet. */
private long _packetSeqWindowFullChecked;
+ private static boolean logMINOR;
/**
* Create a PacketThrottle for a given peer.
@@ -74,6 +75,7 @@
private PacketThrottle(Peer peer, int packetSize) {
_peer = peer;
PACKET_SIZE = packetSize;
+ logMINOR = Logger.shouldLog(Logger.MINOR, this);
}
public synchronized void setRoundTripTime(long rtt) {
@@ -81,6 +83,7 @@
}
public synchronized void notifyOfPacketLost() {
+ logMINOR = Logger.shouldLog(Logger.MINOR, this);
_droppedPackets++;
_totalPackets++;
_simulatedWindowSize *= PACKET_DROP_DECREASE_MULTIPLE;
@@ -91,6 +94,7 @@
}
public synchronized void notifyOfPacketAcknowledged() {
+ logMINOR = Logger.shouldLog(Logger.MINOR, this);
_totalPackets++;
// If we didn't use the whole window, shrink the window a bit.
// This is similar but not identical to RFC2861
@@ -163,8 +167,10 @@
if(windowSize == _packetsInFlight) {
_packetSeqWindowFull =
_packetSeq;
}
+ if(logMINOR) Logger.minor(this,
"Sending, window size now "+windowSize+" packets in flight "+_packetsInFlight);
break;
}
+ if(logMINOR) Logger.minor(this, "Window size:
"+windowSize+" packets in flight "+_packetsInFlight);
try {
wait();
} catch (InterruptedException e) {
@@ -209,6 +215,7 @@
_packetsInFlight--;
PacketThrottle.this.notifyAll();
}
+ if(logMINOR) Logger.minor(this, "Removed packet:
acked");
}
public void disconnected() {
@@ -218,6 +225,7 @@
_packetsInFlight--;
PacketThrottle.this.notifyAll();
}
+ if(logMINOR) Logger.minor(this, "Removed packet:
disconnected");
}
public void fatalError() {
@@ -227,6 +235,7 @@
_packetsInFlight--;
PacketThrottle.this.notifyAll();
}
+ if(logMINOR) Logger.minor(this, "Removed packet:
error");
}
public void sent() {