Update of /cvsroot/freenet/freenet/src/freenet/node/rt
In directory sc8-pr-cvs1:/tmp/cvs-serv21636/src/freenet/node/rt
Modified Files:
ResponseTimeEstimator.java
Log Message:
removed a bunch of unneccesary double synchronizations and added indenting.
Index: ResponseTimeEstimator.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/ResponseTimeEstimator.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -w -r1.11 -r1.12
--- ResponseTimeEstimator.java 25 Oct 2003 10:44:45 -0000 1.11
+++ ResponseTimeEstimator.java 28 Oct 2003 14:14:36 -0000 1.12
@@ -604,10 +604,8 @@
}
public double guessTime(Key k) {
- synchronized(this) {
return (double)guess(k); // resolution 1ms
}
- }
protected final double intToProbability(int x) {
double p = ((double)x) / (1<<30);
@@ -623,19 +621,13 @@
}
public double guessProbability(Key k) {
- int x;
- synchronized(this) {
- x = guess(k);
- }
+ int x = guess(k);
return intToProbability(x);
// range 0.0 to 1.0, so we can use lots of bits
}
public double guessTransferRate(Key k) {
- int x;
- synchronized(this) {
- x = guess(k);
- }
+ int x = guess(k);
double p = ((double)x) / (16*1000);
// 1/16th second resolution. Return in bytes per millisecond.
if(x <= 1) logMINOR("Guessed transfer rate very low!");
@@ -655,10 +647,8 @@
public void reportTime(Key k, long millis) {
int x = convertTime(millis);
- synchronized(this) {
report(k, x);
}
- }
public void reportProbability(Key k, double p) {
if(p < 0.0)
@@ -666,17 +656,13 @@
if(p > 1.0)
throw new IllegalArgumentException("Probability over 1.0");
int x = (int) (p * (1<<30));
- synchronized(this) {
report(k, x);
}
- }
public void reportTransferRate(Key k, double rate) {
int x = convertRate(rate);
- synchronized(this) {
report(k, x);
}
- }
private static int convertRate(double rate) {
if(rate < 0.0)
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs