I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit f4fdbceb authored by zzz's avatar zzz
Browse files

* SSU: Don't offer to introduce when near connection limit

parent c75ff538
No related branches found
No related tags found
No related merge requests found
...@@ -282,7 +282,10 @@ public class EstablishmentManager { ...@@ -282,7 +282,10 @@ public class EstablishmentManager {
} }
if (isNew) { if (isNew) {
// we don't expect inbound connections when hidden, but it could happen // we don't expect inbound connections when hidden, but it could happen
if ((!_context.router().isHidden()) && !_transport.introducersRequired()) { // Don't offer if we are approaching max connections. While Relay Intros do not
// count as connections, we have to keep the connection to this peer up longer if
// we are offering introductions.
if ((!_context.router().isHidden()) && (!_transport.introducersRequired()) && _transport.haveCapacity()) {
long tag = _context.random().nextLong(MAX_TAG_VALUE); long tag = _context.random().nextLong(MAX_TAG_VALUE);
state.setSentRelayTag(tag); state.setSentRelayTag(tag);
if (_log.shouldLog(Log.INFO)) if (_log.shouldLog(Log.INFO))
...@@ -570,7 +573,8 @@ public class EstablishmentManager { ...@@ -570,7 +573,8 @@ public class EstablishmentManager {
private void sendCreated(InboundEstablishState state) { private void sendCreated(InboundEstablishState state) {
long now = _context.clock().now(); long now = _context.clock().now();
if (!_transport.introducersRequired()) { // don't offer if we are approaching max connections (see comments above)
if ((!_transport.introducersRequired()) && _transport.haveCapacity()) {
// offer to relay // offer to relay
// (perhaps we should check our bw usage and/or how many peers we are // (perhaps we should check our bw usage and/or how many peers we are
// already offering introducing?) // already offering introducing?)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment