[freenet-cvs] r18305 - in trunk/freenet/src/freenet: clients/http node

toad at freenetproject.org toad at freenetproject.org
Sat Mar 1 22:54:31 UTC 2008


Author: toad
Date: 2008-03-01 22:54:31 +0000 (Sat, 01 Mar 2008)
New Revision: 18305

Modified:
   trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java
   trunk/freenet/src/freenet/node/FNPPacketMangler.java
   trunk/freenet/src/freenet/node/KeyTracker.java
   trunk/freenet/src/freenet/node/PeerNode.java
   trunk/freenet/src/freenet/node/PeerNodeStatus.java
Log:
Track resent bytes separately for each peer. Display this on the connections pages.

Modified: trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java	2008-03-01 21:32:31 UTC (rev 18304)
+++ trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java	2008-03-01 22:54:31 UTC (rev 18305)
@@ -437,7 +437,7 @@
 
 				if(advancedModeEnabled) {
 					peerTableHeaderRow.addChild("th", "%\u00a0Time Routable");
-					peerTableHeaderRow.addChild("th", "Total\u00a0Traffic\u00a0(in/out)");
+					peerTableHeaderRow.addChild("th", "Total\u00a0Traffic\u00a0(in/out/resent)");
 					peerTableHeaderRow.addChild("th", "Congestion\u00a0Control");
 					peerTableHeaderRow.addChild("th", "Time\u00a0Delta");
 				}
@@ -803,7 +803,7 @@
 			// percent of time connected column
 			peerRow.addChild("td", "class", "peer-idle" /* FIXME */).addChild("#", fix1.format(peerNodeStatus.getPercentTimeRoutableConnection()));
 			// total traffic column
-			peerRow.addChild("td", "class", "peer-idle" /* FIXME */).addChild("#", SizeUtil.formatSize(peerNodeStatus.getTotalInputBytes())+" / "+SizeUtil.formatSize(peerNodeStatus.getTotalOutputBytes()));
+			peerRow.addChild("td", "class", "peer-idle" /* FIXME */).addChild("#", SizeUtil.formatSize(peerNodeStatus.getTotalInputBytes())+" / "+SizeUtil.formatSize(peerNodeStatus.getTotalOutputBytes())+"/"+SizeUtil.formatSize(peerNodeStatus.getResendBytesSent()));
 			// congestion control
 			PacketThrottle t = peerNodeStatus.getThrottle();
 			String val;

Modified: trunk/freenet/src/freenet/node/FNPPacketMangler.java
===================================================================
--- trunk/freenet/src/freenet/node/FNPPacketMangler.java	2008-03-01 21:32:31 UTC (rev 18304)
+++ trunk/freenet/src/freenet/node/FNPPacketMangler.java	2008-03-01 22:54:31 UTC (rev 18305)
@@ -2558,7 +2558,7 @@
 
 	public void resend(ResendPacketItem item) throws PacketSequenceException, WouldBlockException, KeyChangedException, NotConnectedException {
 		processOutgoingPreformatted(item.buf, 0, item.buf.length, item.kt, item.packetNumber, item.callbacks, 0, item.priority);
-		node.nodeStats.resendByteCounter.sentBytes(item.buf.length + fullHeadersLengthMinimum);
+		item.pn.resendByteCounter.sentBytes(item.buf.length + fullHeadersLengthMinimum);
 	}
 
 	public int[] supportedNegTypes() {

Modified: trunk/freenet/src/freenet/node/KeyTracker.java
===================================================================
--- trunk/freenet/src/freenet/node/KeyTracker.java	2008-03-01 21:32:31 UTC (rev 18304)
+++ trunk/freenet/src/freenet/node/KeyTracker.java	2008-03-01 22:54:31 UTC (rev 18305)
@@ -1010,7 +1010,7 @@
             AsyncMessageCallback[] callbacks = element.callbacks;
             // Ignore packet#
             if(logMINOR) Logger.minor(this, "Queueing resend of what was once "+element.packetNumber);
-            messages[i] = new MessageItem(buf, callbacks, true, 0, pn.node.nodeStats.resendByteCounter, element.priority);
+            messages[i] = new MessageItem(buf, callbacks, true, 0, pn.resendByteCounter, element.priority);
         }
         pn.requeueMessageItems(messages, 0, messages.length, true);
         

Modified: trunk/freenet/src/freenet/node/PeerNode.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNode.java	2008-03-01 21:32:31 UTC (rev 18304)
+++ trunk/freenet/src/freenet/node/PeerNode.java	2008-03-01 22:54:31 UTC (rev 18305)
@@ -2476,7 +2476,7 @@
 				Logger.error(this, "No tracker to resend packet " + item.packetNumber + " on");
 				continue;
 			}
-			MessageItem mi = new MessageItem(item.buf, item.callbacks, true, 0, node.nodeStats.resendByteCounter, item.priority);
+			MessageItem mi = new MessageItem(item.buf, item.callbacks, true, 0, resendByteCounter, item.priority);
 			requeueMessageItems(new MessageItem[]{mi}, 0, 1, true);
 		}
 	}
@@ -3612,4 +3612,30 @@
 	public void reportPing(long t) {
 		this.pingAverage.report(t);
 	}
+	
+	private long resendBytesSent;
+	
+	public final ByteCounter resendByteCounter = new ByteCounter() {
+
+		public void receivedBytes(int x) {
+			// Ignore
+		}
+
+		public void sentBytes(int x) {
+			synchronized(PeerNode.this) {
+				resendBytesSent += x;
+			}
+			node.nodeStats.resendByteCounter.sentBytes(x);
+		}
+
+		public void sentPayload(int x) {
+			// Ignore
+		}
+		
+	};
+	
+	public long getResendBytesSent() {
+		return resendBytesSent;
+	}
+	
 }

Modified: trunk/freenet/src/freenet/node/PeerNodeStatus.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerNodeStatus.java	2008-03-01 21:32:31 UTC (rev 18304)
+++ trunk/freenet/src/freenet/node/PeerNodeStatus.java	2008-03-01 22:54:31 UTC (rev 18305)
@@ -87,6 +87,8 @@
 	private final boolean isSeedClient;
 	
 	private final boolean isSearchable;
+	
+	private final long resendBytesSent;
 
 	PeerNodeStatus(PeerNode peerNode, boolean noHeavy) {
 		Peer p = peerNode.getPeer();
@@ -135,6 +137,7 @@
 		this.isSeedClient = peerNode instanceof SeedClientPeerNode;
 		this.isSeedServer = peerNode instanceof SeedServerPeerNode;
 		this.isSearchable = peerNode.isRealConnection();
+		this.resendBytesSent = peerNode.getResendBytesSent();
 	}
 
 	/**
@@ -369,4 +372,9 @@
 	public boolean isSearchable() {
 		return isSearchable;
 	}
+	
+	public long getResendBytesSent() {
+		return resendBytesSent;
+	}
+	
 }




More information about the cvs mailing list