Compare commits

..

13 Commits

Author SHA1 Message Date
jrandom
b92b9d2618 * 2006-06-14 0.6.1.21 released 2006-06-14 02:17:40 +00:00
jrandom
a3db9429a7 2006-06-13 jrandom
* Use a minimum uptime of 2 hours, not 4 (oops)
2006-06-13 23:29:51 +00:00
jrandom
291a5c9578 2006-06-13 jrandom
* Cut down the proactive rejections due to queue size - if we are
      at the point of having decrypted the request off the queue, might
      as well let it through, rather than waste that decryption
2006-06-13 09:38:48 +00:00
jrandom
0a3281c279 2006-06-11 Kloug
* Bugfix to the I2PTunnel IRC filter to support multiple concurrent
      outstanding pings/pongs
2006-06-11 19:48:37 +00:00
jrandom
23f30ba576 2006-06-10 jrandom
* Further reduction in proactive rejections
2006-06-10 20:14:57 +00:00
jrandom
f3de85c4de 2006-06-09 jrandom
* Don't let the pending tunnel request queue grow beyond reason
      (letting things sit for up to 30s when they fail after 10s
      seems a bit... off)
2006-06-10 00:34:44 +00:00
jrandom
a3a4888e0b 2006-06-08 jrandom
* Be more conservative in the proactive rejections
2006-06-09 01:02:40 +00:00
jrandom
6fd7881f8e thanks bar 2006-06-05 06:41:11 +00:00
complication
381f716769 2006-06-04 Complication
* Stop sending a blank line before USER in susimail.
      Seemed to break in rare cases, thanks for reporting, Brachtus!
2006-06-05 01:33:03 +00:00
jrandom
f2078e1523 * 2006-06-04 0.6.1.20 released
2006-06-04  jrandom
    * Reduce the SSU ack frequency
    * Tweaked the tunnel rejection settings to reject less aggressively
2006-06-04 22:25:08 +00:00
jrandom
f2fb87c88b 2006-05-31 jrandom
* Only send netDb searches to the floodfill peers for the time being
    * Add some proof of concept filters for tunnel participation.  By default,
      it will skip peers with an advertised bandwith of less than 32KBps or
      an advertised uptime of less than 2 hours.  If this is sufficient, a
      safer implementation of these filters will be implemented.
2006-05-31 23:23:37 +00:00
complication
fcbea19478 2006-05-30 Complication
* weekly news.xml update
2006-05-31 03:19:24 +00:00
complication
92f25bd4fa 2006-05-18 Complication
* news.xml update
2006-05-19 00:17:10 +00:00
17 changed files with 333 additions and 74 deletions

View File

@@ -27,8 +27,6 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
protected List dests;
private static final long DEFAULT_READ_TIMEOUT = 5*60*1000; // -1
protected long readTimeout = DEFAULT_READ_TIMEOUT;
/** this is the pong response the client expects for their last ping. at least, i hope so... */
private String _expectedPong;
/**
* @throws IllegalArgumentException if the I2PTunnel does not contain
@@ -47,8 +45,6 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
notifyThis,
"IRCHandler " + (++__clientId), tunnel);
_expectedPong = null;
StringTokenizer tok = new StringTokenizer(destinations, ",");
dests = new ArrayList(1);
while (tok.hasMoreTokens()) {
@@ -85,9 +81,10 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
try {
i2ps = createI2PSocket(dest);
i2ps.setReadTimeout(readTimeout);
Thread in = new I2PThread(new IrcInboundFilter(s,i2ps));
StringBuffer expectedPong = new StringBuffer();
Thread in = new I2PThread(new IrcInboundFilter(s,i2ps, expectedPong));
in.start();
Thread out = new I2PThread(new IrcOutboundFilter(s,i2ps));
Thread out = new I2PThread(new IrcOutboundFilter(s,i2ps, expectedPong));
out.start();
} catch (Exception ex) {
if (_log.shouldLog(Log.ERROR))
@@ -123,10 +120,12 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
private Socket local;
private I2PSocket remote;
private StringBuffer expectedPong;
IrcInboundFilter(Socket _local, I2PSocket _remote) {
IrcInboundFilter(Socket _local, I2PSocket _remote, StringBuffer pong) {
local=_local;
remote=_remote;
expectedPong=pong;
}
public void run() {
@@ -153,7 +152,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
inmsg=inmsg.substring(0,inmsg.length()-1);
if (_log.shouldLog(Log.DEBUG))
_log.debug("in: [" + inmsg + "]");
String outmsg = inboundFilter(inmsg);
String outmsg = inboundFilter(inmsg, expectedPong);
if(outmsg!=null)
{
if(!inmsg.equals(outmsg)) {
@@ -195,10 +194,12 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
private Socket local;
private I2PSocket remote;
private StringBuffer expectedPong;
IrcOutboundFilter(Socket _local, I2PSocket _remote) {
IrcOutboundFilter(Socket _local, I2PSocket _remote, StringBuffer pong) {
local=_local;
remote=_remote;
expectedPong=pong;
}
public void run() {
@@ -225,7 +226,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
inmsg=inmsg.substring(0,inmsg.length()-1);
if (_log.shouldLog(Log.DEBUG))
_log.debug("out: [" + inmsg + "]");
String outmsg = outboundFilter(inmsg);
String outmsg = outboundFilter(inmsg, expectedPong);
if(outmsg!=null)
{
if(!inmsg.equals(outmsg)) {
@@ -264,7 +265,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
*
*/
public String inboundFilter(String s) {
public String inboundFilter(String s, StringBuffer expectedPong) {
String field[]=s.split(" ",4);
String command;
@@ -311,9 +312,9 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
// though, does 127.0.0.1 work for irc clients connecting remotely? and for all of them? sure would
// be great if irc clients actually followed the RFCs here, but i guess thats too much to ask.
// If we haven't PINGed them, or the PING we sent isn't something we know how to filter, this
// is null.
String pong = _expectedPong;
_expectedPong = null;
// is blank.
String pong = expectedPong.length() > 0 ? expectedPong.toString() : null;
expectedPong.setLength(0);
return pong;
}
@@ -347,7 +348,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
return null;
}
public String outboundFilter(String s) {
public String outboundFilter(String s, StringBuffer expectedPong) {
String field[]=s.split(" ",3);
String command;
@@ -397,24 +398,24 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase implements Runnable
// Yuck.
String rv = null;
expectedPong.setLength(0);
if (field.length == 1) { // PING
rv = "PING";
_expectedPong = "PONG 127.0.0.1";
expectedPong.append("PONG 127.0.0.1");
} else if (field.length == 2) { // PING nonce
rv = "PING " + field[1];
_expectedPong = "PONG " + field[1];
expectedPong.append("PONG ").append(field[1]);
} else if (field.length == 3) { // PING nonce serverLocation
rv = "PING " + field[1];
_expectedPong = "PONG " + field[1];
expectedPong.append("PONG ").append(field[1]);
} else {
if (_log.shouldLog(Log.ERROR))
_log.error("IRC client sent a PING we don't understand, filtering it (\"" + s + "\")");
rv = null;
_expectedPong = null;
}
if (_log.shouldLog(Log.WARN))
_log.warn("sending ping " + rv + ", waiting for " + _expectedPong + " orig was [" + s + "]");
_log.warn("sending ping " + rv + ", waiting for " + expectedPong + " orig was [" + s + "]");
return rv;
}

View File

@@ -19,7 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Revision: 1.8 $
* $Revision: 1.1 $
*/
package i2p.susi.webmail.pop3;
@@ -373,8 +373,7 @@ public class POP3MailBox {
}
if (socket != null) {
try {
if (sendCmd1a("")
&& sendCmd1a("USER " + user)
if (sendCmd1a("USER " + user)
&& sendCmd1a("PASS " + pass)
&& sendCmd1a("STAT") ) {

View File

@@ -14,8 +14,8 @@ package net.i2p;
*
*/
public class CoreVersion {
public final static String ID = "$Revision: 1.61 $ $Date: 2006/05/09 16:17:19 $";
public final static String VERSION = "0.6.1.19";
public final static String ID = "$Revision: 1.63 $ $Date: 2006-06-04 17:25:14 $";
public final static String VERSION = "0.6.1.21";
public static void main(String args[]) {
System.out.println("I2P Core version: " + VERSION);

View File

@@ -1,4 +1,46 @@
$Id: history.txt,v 1.478 2006-05-17 22:42:57 complication Exp $
$Id: history.txt,v 1.488 2006-06-13 18:29:51 jrandom Exp $
* 2006-06-14 0.6.1.21 released
2006-06-13 jrandom
* Use a minimum uptime of 2 hours, not 4 (oops)
2006-06-13 jrandom
* Cut down the proactive rejections due to queue size - if we are
at the point of having decrypted the request off the queue, might
as well let it through, rather than waste that decryption
2006-06-11 Kloug
* Bugfix to the I2PTunnel IRC filter to support multiple concurrent
outstanding pings/pongs
2006-06-10 jrandom
* Further reduction in proactive rejections
2006-06-09 jrandom
* Don't let the pending tunnel request queue grow beyond reason
(letting things sit for up to 30s when they fail after 10s
seems a bit... off)
2006-06-08 jrandom
* Be more conservative in the proactive rejections
2006-06-04 Complication
* Trim out sending a blank line before USER in susimail.
Seemed to break in rare cases, thanks for reporting, Brachtus!
* 2006-06-04 0.6.1.20 released
2006-06-04 jrandom
* Reduce the SSU ack frequency
* Tweaked the tunnel rejection settings to reject less aggressively
2006-05-31 jrandom
* Only send netDb searches to the floodfill peers for the time being
* Add some proof of concept filters for tunnel participation. By default,
it will skip peers with an advertised bandwith of less than 32KBps or
an advertised uptime of less than 2 hours. If this is sufficient, a
safer implementation of these filters will be implemented.
* 2006-05-18 0.6.1.19 released

View File

@@ -1,5 +1,5 @@
<i2p.news date="$Date: 2006/05/09 16:17:17 $">
<i2p.release version="0.6.1.19" date="2006/05/18" minVersion="0.6"
<i2p.news date="$Date: 2006-06-04 17:25:08 $">
<i2p.release version="0.6.1.21" date="2006/06/13" minVersion="0.6"
anonurl="http://i2p/NF2RLVUxVulR3IqK0sGJR0dHQcGXAzwa6rEO4WAWYXOHw-DoZhKnlbf1nzHXwMEJoex5nFTyiNMqxJMWlY54cvU~UenZdkyQQeUSBZXyuSweflUXFqKN-y8xIoK2w9Ylq1k8IcrAFDsITyOzjUKoOPfVq34rKNDo7fYyis4kT5bAHy~2N1EVMs34pi2RFabATIOBk38Qhab57Umpa6yEoE~rbyR~suDRvD7gjBvBiIKFqhFueXsR2uSrPB-yzwAGofTXuklofK3DdKspciclTVzqbDjsk5UXfu2nTrC1agkhLyqlOfjhyqC~t1IXm-Vs2o7911k7KKLGjB4lmH508YJ7G9fLAUyjuB-wwwhejoWqvg7oWvqo4oIok8LG6ECR71C3dzCvIjY2QcrhoaazA9G4zcGMm6NKND-H4XY6tUWhpB~5GefB3YczOqMbHq4wi0O9MzBFrOJEOs3X4hwboKWANf7DT5PZKJZ5KorQPsYRSq0E3wSOsFCSsdVCKUGsAAAA/i2p/i2pupdate.sud"
publicurl="http://dev.i2p.net/i2p/i2pupdate.sud"
anonannouncement="http://i2p/NF2RLVUxVulR3IqK0sGJR0dHQcGXAzwa6rEO4WAWYXOHw-DoZhKnlbf1nzHXwMEJoex5nFTyiNMqxJMWlY54cvU~UenZdkyQQeUSBZXyuSweflUXFqKN-y8xIoK2w9Ylq1k8IcrAFDsITyOzjUKoOPfVq34rKNDo7fYyis4kT5bAHy~2N1EVMs34pi2RFabATIOBk38Qhab57Umpa6yEoE~rbyR~suDRvD7gjBvBiIKFqhFueXsR2uSrPB-yzwAGofTXuklofK3DdKspciclTVzqbDjsk5UXfu2nTrC1agkhLyqlOfjhyqC~t1IXm-Vs2o7911k7KKLGjB4lmH508YJ7G9fLAUyjuB-wwwhejoWqvg7oWvqo4oIok8LG6ECR71C3dzCvIjY2QcrhoaazA9G4zcGMm6NKND-H4XY6tUWhpB~5GefB3YczOqMbHq4wi0O9MzBFrOJEOs3X4hwboKWANf7DT5PZKJZ5KorQPsYRSq0E3wSOsFCSsdVCKUGsAAAA/pipermail/i2p/2005-September/000878.html"

View File

@@ -4,7 +4,7 @@
<info>
<appname>i2p</appname>
<appversion>0.6.1.19</appversion>
<appversion>0.6.1.21</appversion>
<authors>
<author name="I2P" email="support@i2p.net"/>
</authors>

View File

@@ -1,5 +1,5 @@
<i2p.news date="$Date: 2006/05/09 21:38:42 $">
<i2p.release version="0.6.1.19" date="2006/05/18" minVersion="0.6"
<i2p.news date="$Date: 2006-06-05 01:41:11 $">
<i2p.release version="0.6.1.21" date="2006/06/13" minVersion="0.6"
anonurl="http://i2p/NF2RLVUxVulR3IqK0sGJR0dHQcGXAzwa6rEO4WAWYXOHw-DoZhKnlbf1nzHXwMEJoex5nFTyiNMqxJMWlY54cvU~UenZdkyQQeUSBZXyuSweflUXFqKN-y8xIoK2w9Ylq1k8IcrAFDsITyOzjUKoOPfVq34rKNDo7fYyis4kT5bAHy~2N1EVMs34pi2RFabATIOBk38Qhab57Umpa6yEoE~rbyR~suDRvD7gjBvBiIKFqhFueXsR2uSrPB-yzwAGofTXuklofK3DdKspciclTVzqbDjsk5UXfu2nTrC1agkhLyqlOfjhyqC~t1IXm-Vs2o7911k7KKLGjB4lmH508YJ7G9fLAUyjuB-wwwhejoWqvg7oWvqo4oIok8LG6ECR71C3dzCvIjY2QcrhoaazA9G4zcGMm6NKND-H4XY6tUWhpB~5GefB3YczOqMbHq4wi0O9MzBFrOJEOs3X4hwboKWANf7DT5PZKJZ5KorQPsYRSq0E3wSOsFCSsdVCKUGsAAAA/i2p/i2pupdate.sud"
publicurl="http://dev.i2p.net/i2p/i2pupdate.sud"
anonannouncement="http://i2p/NF2RLVUxVulR3IqK0sGJR0dHQcGXAzwa6rEO4WAWYXOHw-DoZhKnlbf1nzHXwMEJoex5nFTyiNMqxJMWlY54cvU~UenZdkyQQeUSBZXyuSweflUXFqKN-y8xIoK2w9Ylq1k8IcrAFDsITyOzjUKoOPfVq34rKNDo7fYyis4kT5bAHy~2N1EVMs34pi2RFabATIOBk38Qhab57Umpa6yEoE~rbyR~suDRvD7gjBvBiIKFqhFueXsR2uSrPB-yzwAGofTXuklofK3DdKspciclTVzqbDjsk5UXfu2nTrC1agkhLyqlOfjhyqC~t1IXm-Vs2o7911k7KKLGjB4lmH508YJ7G9fLAUyjuB-wwwhejoWqvg7oWvqo4oIok8LG6ECR71C3dzCvIjY2QcrhoaazA9G4zcGMm6NKND-H4XY6tUWhpB~5GefB3YczOqMbHq4wi0O9MzBFrOJEOs3X4hwboKWANf7DT5PZKJZ5KorQPsYRSq0E3wSOsFCSsdVCKUGsAAAA/pipermail/i2p/2005-September/000878.html"
@@ -10,13 +10,12 @@
anonlogs="http://i2p/Nf3ab-ZFkmI-LyMt7GjgT-jfvZ3zKDl0L96pmGQXF1B82W2Bfjf0n7~288vafocjFLnQnVcmZd~-p0-Oolfo9aW2Rm-AhyqxnxyLlPBqGxsJBXjPhm1JBT4Ia8FB-VXt0BuY0fMKdAfWwN61-tj4zIcQWRxv3DFquwEf035K~Ra4SWOqiuJgTRJu7~o~DzHVljVgWIzwf8Z84cz0X33pv-mdG~~y0Bsc2qJVnYwjjR178YMcRSmNE0FVMcs6f17c6zqhMw-11qjKpY~EJfHYCx4lBWF37CD0obbWqTNUIbL~78vxqZRT3dgAgnLixog9nqTO-0Rh~NpVUZnoUi7fNR~awW5U3Cf7rU7nNEKKobLue78hjvRcWn7upHUF45QqTDuaM3yZa7OsjbcH-I909DOub2Q0Dno6vIwuA7yrysccN1sbnkwZbKlf4T6~iDdhaSLJd97QCyPOlbyUfYy9QLNExlRqKgNVJcMJRrIual~Lb1CLbnzt0uvobM57UpqSAAAA/meeting141"
publiclogs="http://www.i2p.net/meeting141" />
&#149;
2006-05-09: 0.6.1.18 <a href="http://dev.i2p/pipermail/i2p/2006-May/001287.html">released</a>
with changes to help reduce periodism, congestion and lease failure.
2006-06-04: 0.6.1.20 <a href="http://dev.i2p/pipermail/i2p/2006-June/001292.html">released</a>
<br />
&#149;
2006-05-09:
<a href="http://dev.i2p/pipermail/i2p/2006-May/001288.html">status notes</a>
2006-05-30:
<a href="http://dev.i2p/pipermail/i2p/2006-May/001291.html">status notes</a>
and
<a href="http://www.i2p/meeting179">meeting log</a>
<a href="http://www.i2p/meeting181">meeting log</a>
<br />
</i2p.news>

View File

@@ -105,7 +105,7 @@ class RouterThrottleImpl implements RouterThrottle {
if (numTunnels > getMinThrottleTunnels()) {
double tunnelGrowthFactor = getTunnelGrowthFactor();
Rate avgTunnels = _context.statManager().getRate("tunnel.participatingTunnels").getRate(60*60*1000);
Rate avgTunnels = _context.statManager().getRate("tunnel.participatingTunnels").getRate(10*60*1000);
if (avgTunnels != null) {
double avg = 0;
if (avgTunnels.getLastEventCount() > 0)
@@ -142,37 +142,37 @@ class RouterThrottleImpl implements RouterThrottle {
double tunnelTestTimeGrowthFactor = getTunnelTestTimeGrowthFactor();
Rate tunnelTestTime1m = _context.statManager().getRate("tunnel.testSuccessTime").getRate(1*60*1000);
Rate tunnelTestTime60m = _context.statManager().getRate("tunnel.testSuccessTime").getRate(60*60*1000);
if ( (tunnelTestTime1m != null) && (tunnelTestTime60m != null) && (tunnelTestTime1m.getLastEventCount() > 0) ) {
Rate tunnelTestTime10m = _context.statManager().getRate("tunnel.testSuccessTime").getRate(10*60*1000);
if ( (tunnelTestTime1m != null) && (tunnelTestTime10m != null) && (tunnelTestTime1m.getLastEventCount() > 0) ) {
double avg1m = tunnelTestTime1m.getAverageValue();
double avg60m = 0;
if (tunnelTestTime60m.getLastEventCount() > 0)
avg60m = tunnelTestTime60m.getAverageValue();
double avg10m = 0;
if (tunnelTestTime10m.getLastEventCount() > 0)
avg10m = tunnelTestTime10m.getAverageValue();
else
avg60m = tunnelTestTime60m.getLifetimeAverageValue();
avg10m = tunnelTestTime10m.getLifetimeAverageValue();
if (avg60m < 2000)
avg60m = 2000; // minimum before complaining
if (avg10m < 5000)
avg10m = 5000; // minimum before complaining
if ( (avg60m > 0) && (avg1m > avg60m * tunnelTestTimeGrowthFactor) ) {
double probAccept = (avg60m*tunnelTestTimeGrowthFactor)/avg1m;
if ( (avg10m > 0) && (avg1m > avg10m * tunnelTestTimeGrowthFactor) ) {
double probAccept = (avg10m*tunnelTestTimeGrowthFactor)/avg1m;
probAccept = probAccept * probAccept; // square the decelerator for test times
int v = _context.random().nextInt(100);
if (v < probAccept*100) {
// ok
if (_log.shouldLog(Log.INFO))
_log.info("Probabalistically accept tunnel request (p=" + probAccept
+ " v=" + v + " test time avg 1m=" + avg1m + " 60m=" + avg60m + ")");
} else {
+ " v=" + v + " test time avg 1m=" + avg1m + " 10m=" + avg10m + ")");
} else if (false) {
if (_log.shouldLog(Log.WARN))
_log.warn("Probabalistically refusing tunnel request (test time avg 1m=" + avg1m
+ " 60m=" + avg60m + ")");
_context.statManager().addRateData("router.throttleTunnelProbTestSlow", (long)(avg1m-avg60m), 0);
+ " 10m=" + avg10m + ")");
_context.statManager().addRateData("router.throttleTunnelProbTestSlow", (long)(avg1m-avg10m), 0);
return TunnelHistory.TUNNEL_REJECT_PROBABALISTIC_REJECT;
}
} else {
if (_log.shouldLog(Log.INFO))
_log.info("Accepting tunnel request, since 60m test time average is " + avg60m
_log.info("Accepting tunnel request, since 60m test time average is " + avg10m
+ " and past 1m only has " + avg1m + ")");
}
}
@@ -227,8 +227,12 @@ class RouterThrottleImpl implements RouterThrottle {
else
timePerRequest = (int)rs.getLifetimeAverageValue();
}
float pctFull = (queuedRequests * timePerRequest) / (10*1000f);
float pReject = 1 - ((1-pctFull) * (1-pctFull));
float pctFull = (queuedRequests * timePerRequest) / (4*1000f);
double pReject = Math.pow(pctFull, 16); //1 - ((1-pctFull) * (1-pctFull));
// let it in because we drop overload- rejecting may be overkill,
// especially since we've done the cpu-heavy lifting to figure out
// whats up
/*
if ( (pctFull >= 1) || (pReject >= _context.random().nextFloat()) ) {
if (_log.shouldLog(Log.WARN))
_log.warn("Rejecting a new tunnel request because we have too many pending requests (" + queuedRequests
@@ -236,6 +240,7 @@ class RouterThrottleImpl implements RouterThrottle {
_context.statManager().addRateData("router.throttleTunnelQueueOverload", queuedRequests, timePerRequest);
return TunnelHistory.TUNNEL_REJECT_TRANSIENT_OVERLOAD;
}
*/
// ok, all is well, let 'er in
_context.statManager().addRateData("tunnel.bytesAllocatedAtAccept", (long)bytesAllocated, 60*10*1000);
@@ -260,7 +265,7 @@ class RouterThrottleImpl implements RouterThrottle {
int used1s = _context.router().get1sRate(); // dont throttle on the 1s rate, its too volatile
int used15s = _context.router().get15sRate();
int used1m = _context.router().get1mRate(); // dont throttle on the 1m rate, its too slow
int used = used15s;
int used = Math.min(used15s,used1s);
double share = _context.router().getSharePercentage();
int availBps = (int)(((maxKBps*1024)*share) - used); //(int)(((maxKBps*1024) - used) * getSharePercentage());
@@ -269,8 +274,11 @@ class RouterThrottleImpl implements RouterThrottle {
_context.statManager().addRateData("router.throttleTunnelBytesUsed", used, maxKBps);
_context.statManager().addRateData("router.throttleTunnelBytesAllowed", availBps, (long)bytesAllocated);
if (used1s > (maxKBps*1024)) {
if (_log.shouldLog(Log.WARN)) _log.warn("Reject tunnel, 1s rate (" + used1s + ") indicates overload.");
long overage = used1m - (maxKBps*1024);
if ( (overage > 0) &&
((overage/(float)(maxKBps*1024f)) > _context.random().nextFloat()) ) {
if (_log.shouldLog(Log.WARN)) _log.warn("Reject tunnel, 1m rate (" + used1m + ") indicates overload.");
return false;
}
@@ -342,9 +350,9 @@ class RouterThrottleImpl implements RouterThrottle {
/** dont ever probabalistically throttle tunnels if we have less than this many */
private int getMinThrottleTunnels() {
try {
return Integer.parseInt(_context.getProperty("router.minThrottleTunnels", "40"));
return Integer.parseInt(_context.getProperty("router.minThrottleTunnels", "1000"));
} catch (NumberFormatException nfe) {
return 40;
return 1000;
}
}

View File

@@ -15,8 +15,8 @@ import net.i2p.CoreVersion;
*
*/
public class RouterVersion {
public final static String ID = "$Revision: 1.418 $ $Date: 2006-05-17 22:42:57 $";
public final static String VERSION = "0.6.1.19";
public final static String ID = "$Revision: 1.428 $ $Date: 2006-06-13 18:29:55 $";
public final static String VERSION = "0.6.1.21";
public final static long BUILD = 0;
public static void main(String args[]) {
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);

View File

@@ -120,6 +120,22 @@ public class FloodfillNetworkDatabaseFacade extends KademliaNetworkDatabaseFacad
else
return false;
}
public List getKnownRouterData() {
List rv = new ArrayList();
DataStore ds = getDataStore();
if (ds != null) {
Set keys = ds.getKeys();
if (keys != null) {
for (Iterator iter = keys.iterator(); iter.hasNext(); ) {
Object o = getDataStore().get((Hash)iter.next());
if (o instanceof RouterInfo)
rv.add(o);
}
}
}
return rv;
}
/**
* Begin a kademlia style search for the key specified, which can take up to timeoutMs and

View File

@@ -87,6 +87,8 @@ class FloodfillPeerSelector extends PeerSelector {
if ( (!SearchJob.onlyQueryFloodfillPeers(_context)) && (_wanted > _matches) && (_key != null) ) {
BigInteger diff = getDistance(_key, entry);
_sorted.put(diff, entry);
} else {
return;
}
}
_matches++;

View File

@@ -121,7 +121,7 @@ class SearchJob extends JobImpl {
public long getExpiration() { return _expiration; }
public long getTimeoutMs() { return _timeoutMs; }
private static final boolean DEFAULT_FLOODFILL_ONLY = false;
private static final boolean DEFAULT_FLOODFILL_ONLY = true;
static boolean onlyQueryFloodfillPeers(RouterContext ctx) {
if (isCongested(ctx))

View File

@@ -15,9 +15,13 @@ import java.util.*;
import net.i2p.data.Hash;
import net.i2p.router.PeerSelectionCriteria;
import net.i2p.router.RouterContext;
import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
import net.i2p.util.SimpleTimer;
import net.i2p.util.Log;
import net.i2p.data.RouterInfo;
import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
/**
* Manage the current state of the statistics
*
@@ -204,12 +208,27 @@ class PeerManager {
return null;
}
public List getPeersByCapability(char capability) {
synchronized (_capabilitiesByPeer) {
List peers = locked_getPeers(capability);
if (peers != null)
return new ArrayList(peers);
if (false) {
synchronized (_capabilitiesByPeer) {
List peers = locked_getPeers(capability);
if (peers != null)
return new ArrayList(peers);
}
return null;
} else {
FloodfillNetworkDatabaseFacade f = (FloodfillNetworkDatabaseFacade)_context.netDb();
List routerInfos = f.getKnownRouterData();
List rv = new ArrayList();
for (Iterator iter = routerInfos.iterator(); iter.hasNext(); ) {
RouterInfo ri = (RouterInfo)iter.next();
String caps = ri.getCapabilities();
if (caps.indexOf(capability) >= 0)
rv.add(ri.getIdentity().calculateHash());
}
if (_log.shouldLog(Log.WARN))
_log.warn("Peers with capacity " + capability + ": " + rv.size());
return rv;
}
return null;
}
public void renderStatusHTML(Writer out) throws IOException {

View File

@@ -22,7 +22,7 @@ public class ACKSender implements Runnable {
private boolean _alive;
/** how frequently do we want to send ACKs to a peer? */
static final int ACK_FREQUENCY = 200;
static final int ACK_FREQUENCY = 500;
public ACKSender(RouterContext ctx, UDPTransport transport) {
_context = ctx;

View File

@@ -86,7 +86,7 @@ class BuildHandler {
handled.add(_inboundBuildMessages.remove(_inboundBuildMessages.size()-1));
} else {
// drop any expired messages
long dropBefore = System.currentTimeMillis() - (BuildRequestor.REQUEST_TIMEOUT*3);
long dropBefore = System.currentTimeMillis() - (BuildRequestor.REQUEST_TIMEOUT/2);
do {
BuildMessageState state = (BuildMessageState)_inboundBuildMessages.get(0);
if (state.recvTime <= dropBefore) {
@@ -601,7 +601,7 @@ class BuildHandler {
for (int i = 0; i < _inboundBuildMessages.size(); i++) {
BuildMessageState cur = (BuildMessageState)_inboundBuildMessages.get(i);
long age = System.currentTimeMillis() - cur.recvTime;
if (age >= BuildRequestor.REQUEST_TIMEOUT*3) {
if (age >= BuildRequestor.REQUEST_TIMEOUT/2) {
_inboundBuildMessages.remove(i);
i--;
dropped++;

View File

@@ -2,11 +2,11 @@ package net.i2p.router.tunnel.pool;
import java.util.*;
import net.i2p.I2PAppContext;
import net.i2p.data.DataFormatException;
import net.i2p.data.Hash;
import net.i2p.data.*;
import net.i2p.router.Router;
import net.i2p.router.RouterContext;
import net.i2p.router.TunnelPoolSettings;
import net.i2p.router.networkdb.kademlia.FloodfillNetworkDatabaseFacade;
import net.i2p.util.Log;
/**
@@ -153,6 +153,103 @@ abstract class TunnelPeerSelector {
if (caps == null) return new HashSet(0);
HashSet rv = new HashSet(caps);
return rv;
} else if (filterSlow(ctx, isInbound, isExploratory)) {
Log log = ctx.logManager().getLog(TunnelPeerSelector.class);
String excludeCaps = ctx.getProperty("router.excludePeerCaps",
String.valueOf(Router.CAPABILITY_BW16) +
String.valueOf(Router.CAPABILITY_BW32));
Set peers = new HashSet();
if (excludeCaps != null) {
char excl[] = excludeCaps.toCharArray();
FloodfillNetworkDatabaseFacade fac = (FloodfillNetworkDatabaseFacade)ctx.netDb();
List known = fac.getKnownRouterData();
if (known != null) {
for (int i = 0; i < known.size(); i++) {
RouterInfo peer = (RouterInfo)known.get(i);
String cap = peer.getCapabilities();
if (cap == null) {
peers.add(peer.getIdentity().calculateHash());
continue;
}
for (int j = 0; j < excl.length; j++) {
if (cap.indexOf(excl[j]) >= 0) {
peers.add(peer.getIdentity().calculateHash());
continue;
}
}
int maxLen = 0;
if (cap.indexOf(FloodfillNetworkDatabaseFacade.CAPACITY_FLOODFILL) >= 0)
maxLen++;
if (cap.indexOf(Router.CAPABILITY_REACHABLE) >= 0)
maxLen++;
if (cap.indexOf(Router.CAPABILITY_UNREACHABLE) >= 0)
maxLen++;
if (cap.length() <= maxLen)
peers.add(peer.getIdentity().calculateHash());
// otherwise, it contains flags we aren't trying to focus on,
// so don't exclude it based on published capacity
if (filterUptime(ctx, isInbound, isExploratory)) {
Properties opts = peer.getOptions();
if (opts != null) {
String val = opts.getProperty("stat_uptime");
long uptimeMs = 0;
if (val != null) {
long factor = 1;
if (val.endsWith("ms")) {
factor = 1;
val = val.substring(0, val.length()-2);
} else if (val.endsWith("s")) {
factor = 1000l;
val = val.substring(0, val.length()-1);
} else if (val.endsWith("m")) {
factor = 60*1000l;
val = val.substring(0, val.length()-1);
} else if (val.endsWith("h")) {
factor = 60*60*1000l;
val = val.substring(0, val.length()-1);
} else if (val.endsWith("d")) {
factor = 24*60*60*1000l;
val = val.substring(0, val.length()-1);
}
try { uptimeMs = Long.parseLong(val); } catch (NumberFormatException nfe) {}
uptimeMs *= factor;
} else {
// not publishing an uptime, so exclude it
peers.add(peer.getIdentity().calculateHash());
continue;
}
long infoAge = ctx.clock().now() - peer.getPublished();
if (infoAge < 0) {
infoAge = 0;
} else if (infoAge > 24*60*60*1000) {
peers.add(peer.getIdentity().calculateHash());
continue;
} else {
if (infoAge + uptimeMs < 2*60*60*1000) {
// up for less than 2 hours, so exclude it
peers.add(peer.getIdentity().calculateHash());
}
}
} else {
// not publishing stats, so exclude it
peers.add(peer.getIdentity().calculateHash());
continue;
}
}
}
}
/*
for (int i = 0; i < excludeCaps.length(); i++) {
List matches = ctx.peerManager().getPeersByCapability(excludeCaps.charAt(i));
if (log.shouldLog(Log.INFO))
log.info("Filtering out " + matches.size() + " peers with capability " + excludeCaps.charAt(i));
peers.addAll(matches);
}
*/
}
return peers;
} else {
return new HashSet(1);
}
@@ -162,6 +259,7 @@ abstract class TunnelPeerSelector {
private static final String PROP_OUTBOUND_CLIENT_EXCLUDE_UNREACHABLE = "router.outboundClientExcludeUnreachable";
private static final String PROP_INBOUND_EXPLORATORY_EXCLUDE_UNREACHABLE = "router.inboundExploratoryExcludeUnreachable";
private static final String PROP_INBOUND_CLIENT_EXCLUDE_UNREACHABLE = "router.inboundClientExcludeUnreachable";
private static final boolean DEFAULT_OUTBOUND_EXPLORATORY_EXCLUDE_UNREACHABLE = false;
private static final boolean DEFAULT_OUTBOUND_CLIENT_EXCLUDE_UNREACHABLE = false;
private static final boolean DEFAULT_INBOUND_EXPLORATORY_EXCLUDE_UNREACHABLE = false;
@@ -186,4 +284,56 @@ abstract class TunnelPeerSelector {
//System.err.println("Filter unreachable? " + rv + " (inbound? " + isInbound + ", exploratory? " + isExploratory);
return rv;
}
private static final String PROP_OUTBOUND_EXPLORATORY_EXCLUDE_SLOW = "router.outboundExploratoryExcludeSlow";
private static final String PROP_OUTBOUND_CLIENT_EXCLUDE_SLOW = "router.outboundClientExcludeSlow";
private static final String PROP_INBOUND_EXPLORATORY_EXCLUDE_SLOW = "router.inboundExploratoryExcludeSlow";
private static final String PROP_INBOUND_CLIENT_EXCLUDE_SLOW = "router.inboundClientExcludeSlow";
protected boolean filterSlow(RouterContext ctx, boolean isInbound, boolean isExploratory) {
boolean def = true;
String val = null;
if (isExploratory)
if (isInbound)
val = ctx.getProperty(PROP_INBOUND_EXPLORATORY_EXCLUDE_SLOW);
else
val = ctx.getProperty(PROP_OUTBOUND_EXPLORATORY_EXCLUDE_SLOW);
else
if (isInbound)
val = ctx.getProperty(PROP_INBOUND_CLIENT_EXCLUDE_SLOW);
else
val = ctx.getProperty(PROP_OUTBOUND_CLIENT_EXCLUDE_SLOW);
boolean rv = (val != null ? Boolean.valueOf(val).booleanValue() : def);
//System.err.println("Filter unreachable? " + rv + " (inbound? " + isInbound + ", exploratory? " + isExploratory);
return rv;
}
private static final String PROP_OUTBOUND_EXPLORATORY_EXCLUDE_UPTIME = "router.outboundExploratoryExcludeUptime";
private static final String PROP_OUTBOUND_CLIENT_EXCLUDE_UPTIME = "router.outboundClientExcludeUptime";
private static final String PROP_INBOUND_EXPLORATORY_EXCLUDE_UPTIME = "router.inboundExploratoryExcludeUptime";
private static final String PROP_INBOUND_CLIENT_EXCLUDE_UPTIME = "router.inboundClientExcludeUptime";
/** do we want to skip peers who haven't been up for long? */
protected boolean filterUptime(RouterContext ctx, boolean isInbound, boolean isExploratory) {
boolean def = true;
String val = null;
if (isExploratory)
if (isInbound)
val = ctx.getProperty(PROP_INBOUND_EXPLORATORY_EXCLUDE_UPTIME);
else
val = ctx.getProperty(PROP_OUTBOUND_EXPLORATORY_EXCLUDE_UPTIME);
else
if (isInbound)
val = ctx.getProperty(PROP_INBOUND_CLIENT_EXCLUDE_UPTIME);
else
val = ctx.getProperty(PROP_OUTBOUND_CLIENT_EXCLUDE_UPTIME);
boolean rv = (val != null ? Boolean.valueOf(val).booleanValue() : def);
//System.err.println("Filter unreachable? " + rv + " (inbound? " + isInbound + ", exploratory? " + isExploratory);
return rv;
}
}

View File

@@ -495,11 +495,12 @@ public class TunnelPoolManager implements TunnelManagerFacade {
out.write("<td align=right>" + info.getProcessedMessagesCount() + "KB</td>\n");
for (int j = 0; j < info.getLength(); j++) {
Hash peer = info.getPeer(j);
String cap = getCapacity(peer);
TunnelId id = (info.isInbound() ? info.getReceiveTunnelId(j) : info.getSendTunnelId(j));
if (_context.routerHash().equals(peer))
out.write("<td><i>" + peer.toBase64().substring(0,4) + (id == null ? "" : ":" + id) + "</i></td>");
out.write("<td><i>" + peer.toBase64().substring(0,4) + (id == null ? "" : ":" + id) + "</i>" + cap + "</td>");
else
out.write("<td>" + peer.toBase64().substring(0,4) + (id == null ? "" : ":" + id) + "</td>");
out.write("<td>" + peer.toBase64().substring(0,4) + (id == null ? "" : ":" + id) + cap + "</td>");
}
out.write("</tr>\n");
@@ -526,4 +527,26 @@ public class TunnelPoolManager implements TunnelManagerFacade {
out.write("<b>No tunnels, waiting for the grace period to end</b><br />\n");
out.write("Lifetime bandwidth usage: " + processedIn + "KB in, " + processedOut + "KB out<br />");
}
private String getCapacity(Hash peer) {
RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer);
if (info != null) {
String caps = info.getCapabilities();
if (caps.indexOf(Router.CAPABILITY_BW16) >= 0) {
return "[&lt;16&nbsp;]";
} else if (caps.indexOf(Router.CAPABILITY_BW32) >= 0) {
return "[&lt;32&nbsp;]";
} else if (caps.indexOf(Router.CAPABILITY_BW64) >= 0) {
return "[&lt;64&nbsp;]";
} else if (caps.indexOf(Router.CAPABILITY_BW128) >= 0) {
return "<b>[&lt;128]</b>";
} else if (caps.indexOf(Router.CAPABILITY_BW256) >= 0) {
return "<b>[&gt;128]</b>";
} else {
return "[&nbsp;&nbsp;&nbsp;&nbsp;]";
}
} else {
return "[&nbsp;&nbsp;&nbsp;&nbsp;]";
}
}
}