merge of '565f0421784f8f71177ebf0bd682750f98bce67b'

and 'e9067362adb090ff1e3d8ae327fb313ded00e9c6'
This commit is contained in:
zzz
2009-07-11 22:32:29 +00:00
22 changed files with 115 additions and 63 deletions

View File

@ -512,7 +512,8 @@ public class I2PSnarkServlet extends HttpServlet {
Map.Entry entry = (Map.Entry)iter.next();
String name = (String)entry.getKey();
String baseURL = (String)entry.getValue();
if (!baseURL.startsWith(announce))
if (!(baseURL.startsWith(announce) || // vvv hack for non-b64 announce in list vvv
(announce.startsWith("http://lnQ6yoBT") && baseURL.startsWith("http://tracker2.postman.i2p/"))))
continue;
int e = baseURL.indexOf('=');
if (e < 0)

View File

@ -9,12 +9,17 @@ public class CSSHelper extends HelperBase {
public static final String PROP_THEME_NAME = "routerconsole.theme";
private static final String BASE = "/themes/console/";
private static final String FORCE = "classic";
public String getTheme() {
public String getTheme(String userAgent) {
String url = BASE;
String theme = _context.getProperty(PROP_THEME_NAME);
if (theme != null)
url += theme + "/";
if (userAgent != null && userAgent.contains("MSIE")) {
url += FORCE + "/";
} else {
String theme = _context.getProperty(PROP_THEME_NAME);
if (theme != null)
url += theme + "/";
}
return url;
}
}

View File

@ -17,4 +17,4 @@
%>
<jsp:useBean class="net.i2p.router.web.CSSHelper" id="cssHelper" scope="request" />
<jsp:setProperty name="cssHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<link href="<%=cssHelper.getTheme()%>console.css" rel="stylesheet" type="text/css" />
<link href="<%=cssHelper.getTheme(request.getHeader("User-Agent"))%>console.css" rel="stylesheet" type="text/css" />

View File

@ -5,6 +5,28 @@
added to advanced config.
2009-07-07 dr|z3d
2009-07-07 dr|z3d
2009-07-11 zzz
* Build Handler: Drop rather than reject requests when near
conn limits and the next hop is not connected, to reduce
connection congestion
* Console: Force IE to the classic theme
* I2PSnark:
- Bring back details links for Postman2 B64 torrents
* I2PTunnel:
- Make reduce-on-idle the default for all the shared clients
for new installs (15m)
* Profile Organizer:
- Allow NTCP-only peers in inbound tunnels
* Transports:
- Move from a single connection limit threshold (80%) to
two (75% and 87%), and only start rejecting tunnels
at the higher threshold, to increase build success
- Move some limit methods from the transports to TransportImpl
- Add limit methods with a threshold argument
- Increase default SSU conn limits a little more
2009-07-07 dr|z3d
* Introducing 2 new console themes (light & dark), in addition
to changes to the console navigation; navbar now resides in
the sidepanel and other stuff besides. More to follow!

View File

@ -10,6 +10,9 @@ tunnel.0.i2cpHost=127.0.0.1
tunnel.0.i2cpPort=7654
tunnel.0.option.inbound.nickname=shared clients
tunnel.0.option.outbound.nickname=shared clients
tunnel.0.option.i2cp.reduceIdleTime=900000
tunnel.0.option.i2cp.reduceOnIdle=true
tunnel.0.option.i2cp.reduceQuantity=1
tunnel.0.option.i2p.streaming.connectDelay=1000
tunnel.0.startOnLoad=true
@ -25,6 +28,9 @@ tunnel.1.i2cpHost=127.0.0.1
tunnel.1.i2cpPort=7654
tunnel.1.option.inbound.nickname=shared clients
tunnel.1.option.outbound.nickname=shared clients
tunnel.1.option.i2cp.reduceIdleTime=900000
tunnel.1.option.i2cp.reduceOnIdle=true
tunnel.1.option.i2cp.reduceQuantity=1
tunnel.1.option.i2p.streaming.connectDelay=1000
tunnel.1.option.i2p.streaming.maxWindowSize=16
tunnel.1.startOnLoad=true
@ -41,6 +47,9 @@ tunnel.2.i2cpHost=127.0.0.1
tunnel.2.i2cpPort=7654
tunnel.2.option.inbound.nickname=shared clients
tunnel.2.option.outbound.nickname=shared clients
tunnel.2.option.i2cp.reduceIdleTime=900000
tunnel.2.option.i2cp.reduceOnIdle=true
tunnel.2.option.i2cp.reduceQuantity=1
tunnel.2.startOnLoad=false
# local eepserver
@ -70,6 +79,9 @@ tunnel.4.listenPort=7659
tunnel.4.name=smtp.postman.i2p
tunnel.4.option.inbound.nickname=shared clients
tunnel.4.option.outbound.nickname=shared clients
tunnel.4.option.i2cp.reduceIdleTime=900000
tunnel.4.option.i2cp.reduceOnIdle=true
tunnel.4.option.i2cp.reduceQuantity=1
tunnel.4.option.i2p.streaming.connectDelay=1000
tunnel.4.startOnLoad=true
tunnel.4.targetDestination=smtp.postman.i2p
@ -85,6 +97,9 @@ tunnel.5.interface=127.0.0.1
tunnel.5.listenPort=7660
tunnel.5.option.inbound.nickname=shared clients
tunnel.5.option.outbound.nickname=shared clients
tunnel.5.option.i2cp.reduceIdleTime=900000
tunnel.5.option.i2cp.reduceOnIdle=true
tunnel.5.option.i2cp.reduceQuantity=1
tunnel.5.option.i2p.streaming.connectDelay=1000
tunnel.5.startOnLoad=true
tunnel.5.targetDestination=pop.postman.i2p

View File

@ -75,6 +75,4 @@ You may also want to review the information on the
<a href="http://www.i2p2.i2p/">I2P website</a>, post up messages to the
<a href="http://forum.i2p2.de/">I2P discussion forum</a>, or swing by #i2p or
#i2p-chat on IRC at <a href="irc://irc.freenode.net/#i2p">irc.freenode.net</a>, irc.postman.i2p or irc.freshcoffee.i2p (they're linked together).</p>
<p><b>As a note, you can change this page by editing the file "docs/readme.html"</b></p>
</div>
</div>

View File

@ -72,5 +72,3 @@
chatten auf #i2p or #i2p-chat beim IRC auf
<a href="irc://irc.freenode.net/#i2p">irc.freenode.net</a>, irc.postman.i2p
oder irc.freshcoffee.i2p (die verbunden sind).</p>
<p><b>&Uuml;brigens, diese Seite kannst Du &auml;ndern indem Du "docs/readme_de.html" editierst</b></p>

View File

@ -37,5 +37,3 @@
<h2><a name="trouble">D&eacute;pannage</a></h2>
<p>Soyez patient - i2p peut s'av&eacute;rer lent &agrave; d&eacute;marrer la premi&egrave;re fois car il recherche des pairs. Si, apr&egrave;s 30 minutes, votre Actives: connect&eacute;/r&eacute;cent compte moins de 10 pairs connect&eacute;s, vous devez ouvrir le port 8887 sur votre pare-feu pour avoir une meilleure connection. Si vous ne pouvez acc&eacute;der &agrave; aucun eepsite (m&ecirc;me <a href="http://www.i2p2.i2p/">www.i2p2.i2p</a>), soyez s&ucirc;r que votre navigateur utilise bien le proxy localhost sur le port 4444. Vous pouvez aussi faire part de votre d&eacute;marche sur le <a href="http://www.i2p2.i2p/">site web I2P</a>, poster des message sur le <a href="http://forum.i2p/">forum de discussion</a>, ou passer par #i2p ou #i2p-chat sur IRC sur le serveur <a href="irc://irc.freenode.net/#i2p">irc.freenode.net</a>, irc.postman.i2p ou irc.freshcoffee.i2p (ils sont li&eacute;s).</p>
<p><b>Comme vous pouvez le remarquer, il suffit d'&eacute;diter la page "docs/readme.html" pour changer la page d'acceuil</b></p>

View File

@ -56,5 +56,3 @@ Je zou best ook de informatie controleren op de
<a href="http://www.i2p2.i2p/">I2P website</a>, of plaats een bericht op het
<a href="http://forum.i2p/">I2P discussie forum</a>, of kom langs bij #i2p of
#i2p-chat op IRC bij de kanalen <a href="irc://irc.freenode.net/#i2p">irc.freenode.net</a>, irc.postman.i2p of irc.freshcoffee.i2p (ze linken allemaal door naar elkaar).</p>
<p><b>Als extra informatie, je kan deze pagina wijzigen door het bestand "docs/readme_nl.html" aan te passen.</b></p>

View File

@ -98,6 +98,3 @@ f&ouml;rbi #i2p eller
#i2p-chat p&aring; IRC p<> <a
href="irc://irc.freenode.net/#i2p">irc.freenode.net</a>, irc.postman.i2p
eller irc.freshcoffee.i2p (de &auml;r alla sammankopplade).</p>
<p><b>Du kan f&ouml;r&auml;ndra denh&auml;r sidan genom att &auml;ndra i filen
"docs/readme_sv.html"</b></p>

View File

@ -24,5 +24,3 @@
<h2><a name="trouble"><EFBFBD><EFBFBD><EFBFBD>ѽ<EFBFBD><EFBFBD><EFBFBD></a></h2>
<p><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - I2P <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>ڵ㣬<DAB5><E3A3AC><EFBFBD>ܱȽϻ<C8BD><CFBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>30<33><30><EFBFBD>Ӻ<EFBFBD><D3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<C4BB>ڵ<EFBFBD>(Active:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 10 <20><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD>ǽ<EFBFBD>д<EFBFBD><D0B4><EFBFBD> 8887 <20>˿ڸ<CBBF><DAB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܡ<EFBFBD><DCA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD>EEPSITE(<28><><EFBFBD><EFBFBD> <a href="http://www.i2p2.i2p/">www.i2p2.i2p</a>)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ص<EFBFBD> localhost:4444<34><34><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD>Բ鿴 <a href="http://www.i2p2.i2p/">I2P <20><>վ</a> <20>ϵ<EFBFBD><CFB5><EFBFBD>Ϣ, <20><> <a href="http://forum.i2p2.de/">I2P <20><>̳</a> <20>з<EFBFBD><D0B7><EFBFBD>, <20><> <a href="irc://irc.freenode.net/#i2p">irc.freenode.net</a> , irc.postman.i2p <20><> irc.freshcoffee.i2p <20>ϵ<EFBFBD> #i2p <20><> #i2p-chat <20><><EFBFBD><EFBFBD>IRCƵ<43><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>)<29><></p>
<p><B><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD>&quot;docs/readme_zh.html&quot; <20>޸ı<DEB8>ҳ<EFBFBD></B></p>

View File

@ -34,8 +34,8 @@ public abstract class CommSystemFacade implements Service {
public int countActivePeers() { return 0; }
public int countActiveSendPeers() { return 0; }
public boolean haveInboundCapacity() { return true; }
public boolean haveOutboundCapacity() { return true; }
public boolean haveInboundCapacity(int pct) { return true; }
public boolean haveOutboundCapacity(int pct) { return true; }
public boolean haveHighOutboundCapacity() { return true; }
public List getMostRecentErrorMessages() { return Collections.EMPTY_LIST; }

View File

@ -15,8 +15,7 @@ import net.i2p.util.Log;
*
* Also, as this is now called from PersistentDataStore, not from the
* routerconsole, we can get started as soon as the netdb has read
* the netDb/ directory, not when the console starts,
router/java/src/net/i2p/router/networkdb/eseed/ReseedChecker.java
* the netDb/ directory, not when the console starts.
*/
public class ReseedChecker {

View File

@ -541,9 +541,11 @@ public class ProfileOrganizer {
l.add(peer);
else {
RouterAddress ra = info.getTargetAddress("SSU");
// Definitely don't want peers with no SSU address at all
// peers with no SSU address at all are fine.
// as long as they have NTCP
if (ra == null) {
l.add(peer);
if (info.getTargetAddress("NTCP") == null)
l.add(peer);
continue;
}
// This is the quick way of doing UDPAddress.getIntroducerCount() > 0

View File

@ -70,9 +70,9 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
@Override
public int countActiveSendPeers() { return (_manager == null ? 0 : _manager.countActiveSendPeers()); }
@Override
public boolean haveInboundCapacity() { return (_manager == null ? false : _manager.haveInboundCapacity()); }
public boolean haveInboundCapacity(int pct) { return (_manager == null ? false : _manager.haveInboundCapacity(pct)); }
@Override
public boolean haveOutboundCapacity() { return (_manager == null ? false : _manager.haveOutboundCapacity()); }
public boolean haveOutboundCapacity(int pct) { return (_manager == null ? false : _manager.haveOutboundCapacity(pct)); }
@Override
public boolean haveHighOutboundCapacity() { return (_manager == null ? false : _manager.haveHighOutboundCapacity()); }

View File

@ -44,10 +44,11 @@ public interface Transport {
public void setListener(TransportEventListener listener);
public String getStyle();
public int countPeers();
public int countActivePeers();
public int countActiveSendPeers();
public boolean haveCapacity();
public boolean haveHighCapacity();
public boolean haveCapacity(int pct);
public Vector getClockSkews();
public List getMostRecentErrorMessages();

View File

@ -78,8 +78,13 @@ public abstract class TransportImpl implements Transport {
}
/**
* How many peers can we talk to right now?
*
* How many peers are we connected to?
* For NTCP, this is the same as active,
* but SSU actually looks at idle time for countActivePeers()
*/
public int countPeers() { return countActivePeers(); }
/**
* How many peers active in the last few minutes?
*/
public int countActivePeers() { return 0; }
/**
@ -108,14 +113,22 @@ public abstract class TransportImpl implements Transport {
}
// increase limit for SSU, for now
if (style.equals("udp"))
def = def * 4 / 3;
def = def * 3 / 2;
return _context.getProperty("i2np." + style + ".maxConnections", def);
}
private static final int DEFAULT_CAPACITY_PCT = 75;
/**
* Can we initiate or accept a connection to another peer, saving some margin
*/
public boolean haveCapacity() { return true; }
public boolean haveCapacity() {
return haveCapacity(DEFAULT_CAPACITY_PCT);
}
/** @param pct are we under x% 0-100 */
public boolean haveCapacity(int pct) {
return countPeers() < getMaxConnections() * pct / 100;
}
/**
* Return our peer clock skews on a transport.

View File

@ -206,15 +206,18 @@ public class TransportManager implements TransportEventListener {
/**
* Is at least one transport below its outbound connection limit + some margin
* Use for throttling in the router.
*
* @param pct percent of limit 0-100
*/
public boolean haveOutboundCapacity() {
public boolean haveOutboundCapacity(int pct) {
for (int i = 0; i < _transports.size(); i++) {
if (((Transport)_transports.get(i)).haveCapacity())
if (((Transport)_transports.get(i)).haveCapacity(pct))
return true;
}
return false;
}
private static final int HIGH_CAPACITY_PCT = 50;
/**
* Are all transports well below their outbound connection limit
* Use for throttling in the router.
@ -223,7 +226,7 @@ public class TransportManager implements TransportEventListener {
if (_transports.size() <= 0)
return false;
for (int i = 0; i < _transports.size(); i++) {
if (!((Transport)_transports.get(i)).haveHighCapacity())
if (!((Transport)_transports.get(i)).haveCapacity(HIGH_CAPACITY_PCT))
return false;
}
return true;
@ -232,10 +235,12 @@ public class TransportManager implements TransportEventListener {
/**
* Is at least one transport below its inbound connection limit + some margin
* Use for throttling in the router.
*
* @param pct percent of limit 0-100
*/
public boolean haveInboundCapacity() {
public boolean haveInboundCapacity(int pct) {
for (int i = 0; i < _transports.size(); i++) {
if (_transports.get(i).getCurrentAddress() != null && _transports.get(i).haveCapacity())
if (_transports.get(i).getCurrentAddress() != null && _transports.get(i).haveCapacity(pct))
return true;
}
return false;

View File

@ -321,15 +321,6 @@ public class NTCPTransport extends TransportImpl {
return countActivePeers() < getMaxConnections();
}
@Override
public boolean haveCapacity() {
return countActivePeers() < getMaxConnections() * 4 / 5;
}
public boolean haveHighCapacity() {
return countActivePeers() < getMaxConnections() / 2;
}
/** queue up afterSend call, which can take some time w/ jobs, etc */
void sendComplete(OutNetMessage msg) { _finisher.add(msg); }

View File

@ -1334,6 +1334,13 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
super.afterSend(m, true);
}
@Override
public int countPeers() {
synchronized (_peersByIdent) {
return _peersByIdent.size();
}
}
@Override
public int countActivePeers() {
long now = _context.clock().now();
@ -1379,19 +1386,6 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
}
}
@Override
public boolean haveCapacity() {
synchronized (_peersByIdent) {
return _peersByIdent.size() < getMaxConnections() * 4 / 5;
}
}
public boolean haveHighCapacity() {
synchronized (_peersByIdent) {
return _peersByIdent.size() < getMaxConnections() / 2;
}
}
/**
* Return our peer clock skews on this transport.
* Vector composed of Long, each element representing a peer skew in seconds.

View File

@ -253,6 +253,12 @@ public class TunnelDispatcher implements Service {
return _participatingConfig.size();
}
/******* may be used for congestion control later...
public int getParticipatingInboundGatewayCount() {
return _inboundGateways.size();
}
*******/
/** what is the date/time on which the last non-locally-created tunnel expires? */
public long getLastParticipatingExpiration() { return _lastParticipatingExpiration; }

View File

@ -65,6 +65,7 @@ class BuildHandler {
_context.statManager().createRateStat("tunnel.rejectOverloaded", "How long we had to wait before processing the request (when it was rejected)", "Tunnels", new long[] { 60*1000, 10*60*1000 });
_context.statManager().createRateStat("tunnel.acceptLoad", "Delay before processing the accepted request", "Tunnels", new long[] { 60*1000, 10*60*1000 });
_context.statManager().createRateStat("tunnel.dropConnLimits", "Drop instead of reject due to conn limits", "Tunnels", new long[] { 60*1000, 10*60*1000 });
_context.statManager().createRateStat("tunnel.dropLoad", "How long we had to wait before finally giving up on an inbound request (period is queue count)?", "Tunnels", new long[] { 60*1000, 10*60*1000 });
_context.statManager().createRateStat("tunnel.dropLoadDelay", "How long we had to wait before finally giving up on an inbound request?", "Tunnels", new long[] { 60*1000, 10*60*1000 });
_context.statManager().createRateStat("tunnel.dropLoadBacklog", "How many requests were pending when they were so lagged that we had to drop a new inbound request??", "Tunnels", new long[] { 60*1000, 10*60*1000 });
@ -466,7 +467,6 @@ class BuildHandler {
return 0;
}
private static final String PROP_REJECT_NONPARTICIPANT = "router.participantOnly";
private void handleReq(RouterInfo nextPeerInfo, BuildMessageState state, BuildRequestRecord req, Hash nextPeer) {
long ourId = req.readReceiveTunnelId();
long nextId = req.readNextTunnelId();
@ -510,8 +510,8 @@ class BuildHandler {
* reject this request.
*/
if (response == 0 &&
((isInGW && ! _context.commSystem().haveInboundCapacity()) ||
(isOutEnd && ! _context.commSystem().haveOutboundCapacity()))) {
((isInGW && ! _context.commSystem().haveInboundCapacity(87)) ||
(isOutEnd && ! _context.commSystem().haveOutboundCapacity(87)))) {
_context.throttle().setTunnelStatus("Rejecting tunnels: Connection limit");
response = TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
}
@ -569,6 +569,17 @@ class BuildHandler {
(isOutEnd ? "outbound endpoint" : isInGW ? "inbound gw" : "participant"));
}
// Connection congestion control:
// If we rejected the request, are near our conn limits, and aren't connected to the next hop,
// just drop it.
if (response != 0 &&
(! _context.routerHash().equals(nextPeer)) &&
(! _context.commSystem().haveOutboundCapacity(75)) &&
(! _context.commSystem().isEstablished(nextPeer))) {
_context.statManager().addRateData("tunnel.dropConnLimits", 1, 0);
return;
}
BuildResponseRecord resp = new BuildResponseRecord();
byte reply[] = resp.create(_context, response, req.readReplyKey(), req.readReplyIV(), state.msg.getUniqueId());
for (int j = 0; j < TunnelBuildMessage.RECORD_COUNT; j++) {