Update of /cvsroot/freenet/freenet/src/freenet/transport
In directory sc8-pr-cvs1:/tmp/cvs-serv20832/freenet/src/freenet/transport
Modified Files:
tcpConnection.java
Log Message:
Make queriesPerHour a time weighted decaying average.
Set lsHalfLifeHours=0 for previous behavior.
Print the local port number together with peer IP
in order to correlate with netstat output, both
in logs and on "Open Connections" servlet.
Version.java
(Version) buildNumber = 6216
tcpConnection.java Add import freenet.node.Node;
(tcpConnection.toString)
Compare sock.getLocalPort to Node.listenport.
Add import freenet.node.Node;
If not equal, prepend localPort+">" to IP number of peer.
If equal, append ">local" to IP number of peer.
Node.java Add new configuration option, lsHalfLifeHours
(Node.static) add description strings, default value 0.5
(Node) static public double lsHalfLifeHours;
(Node.init) lsHalfLifeHours = params.getDouble("lsHalfLifeHours");
Main.java
(Main.main) Pass Node.lsHalfLifeHours to new LoadStats()
LoadStats.java
(LoadStats) new field queriesPerHour
(LoadStats.LoadStats) accept lsHalfLifeHours parameter,
queriesPerHour = new DecayingTimeWeightedAverage()
specifying time unit of one hour and half life
from the parameter.
(receivedQuery) move call to System.currentTimeMillis()
out of synchronized(timesLock). Once every times.length
calls, call localQueryTraffic() to compute average.
(localQueryTraffic) Note current time upon entry.
Always make an estimate, even when fewer than
lsAcceptRatioSamples queries have been received.
Return the decaying time weighted average of
events per hour, instead of the instanteous value.
(DecayingTimeWeightedAverage) New private class,
with method average(now, start, events)
calculates average events per unit time, decaying
with half-life specified in constructor.
If value was A events/hour, and subsequent
calls submit B events/hour, after one half-life,
the average will be (A+B)/2, and after two,
the average will be (A+3B)/2. Exponential decay.
Probably should be moved into utilities...
Announcing.java fixed typo in a comment.
OpenConnectionManager.java
Change "Connections transferring (Receiving/Transmitting)"
to "(Transmitting/Receiving)"
Fix some comments. Indentation.
Append ch.getLocalPort() to the inbound/outbound
sending/receiving/both indicator. Should add a new column.
ConnectionHandler.java
(getLocalPort) new method returns conn.getSocket().getLocalPort()
or zero if any returned null.
Index: tcpConnection.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/transport/tcpConnection.java,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- tcpConnection.java 18 Sep 2003 17:48:13 -0000 1.43
+++ tcpConnection.java 3 Oct 2003 08:35:20 -0000 1.44
@@ -1,6 +1,7 @@
package freenet.transport;
import freenet.*;
+import freenet.node.Node; // for listenPort
import freenet.support.io.*;
import freenet.support.Logger;
import java.io.*;
@@ -639,10 +640,18 @@
sb.append("CLOSED"); //you won't believe it till you see it with
} else if (sock!=null) {
InetAddress addr = sock.getInetAddress();
+ int localPort = sock.getLocalPort();
+ if (localPort != Node.listenPort) {
+ sb.append(localPort);
+ sb.append(">");
+ }
if(addr != null) //this is becoming increasingly common --zab
sb.append(addr.getHostAddress());
sb.append(":");
sb.append(sock.getPort());
+ if (localPort == Node.listenPort) {
+ sb.append(">local");
+ }
} else sb.append("null");
sb.append(","+super.toString());
return sb.toString();
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs