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

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

Reduce priority of participating traffic

parent a7a6c75a
No related branches found
No related tags found
No related merge requests found
...@@ -41,7 +41,7 @@ public class InboundGatewayReceiver implements TunnelGateway.Receiver { ...@@ -41,7 +41,7 @@ public class InboundGatewayReceiver implements TunnelGateway.Receiver {
out.setMessage(msg); out.setMessage(msg);
out.setTarget(_target); out.setTarget(_target);
out.setExpiration(msg.getMessageExpiration()); out.setExpiration(msg.getMessageExpiration());
out.setPriority(400); out.setPriority(200);
_context.outNetMessagePool().add(out); _context.outNetMessagePool().add(out);
return msg.getUniqueId(); return msg.getUniqueId();
} }
......
...@@ -16,12 +16,14 @@ import net.i2p.util.Log; ...@@ -16,12 +16,14 @@ import net.i2p.util.Log;
*/ */
public class OutboundMessageDistributor { public class OutboundMessageDistributor {
private RouterContext _context; private RouterContext _context;
private int _priority;
private Log _log; private Log _log;
private static final int MAX_DISTRIBUTE_TIME = 10*1000; private static final int MAX_DISTRIBUTE_TIME = 10*1000;
public OutboundMessageDistributor(RouterContext ctx) { public OutboundMessageDistributor(RouterContext ctx, int priority) {
_context = ctx; _context = ctx;
_priority = priority;
_log = ctx.logManager().getLog(OutboundMessageDistributor.class); _log = ctx.logManager().getLog(OutboundMessageDistributor.class);
} }
...@@ -62,7 +64,7 @@ public class OutboundMessageDistributor { ...@@ -62,7 +64,7 @@ public class OutboundMessageDistributor {
out.setExpiration(_context.clock().now() + MAX_DISTRIBUTE_TIME); out.setExpiration(_context.clock().now() + MAX_DISTRIBUTE_TIME);
out.setTarget(target); out.setTarget(target);
out.setMessage(m); out.setMessage(m);
out.setPriority(400); out.setPriority(_priority);
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("queueing outbound message to " + target.getIdentity().calculateHash().toBase64().substring(0,4)); _log.debug("queueing outbound message to " + target.getIdentity().calculateHash().toBase64().substring(0,4));
......
...@@ -26,7 +26,7 @@ public class OutboundTunnelEndpoint { ...@@ -26,7 +26,7 @@ public class OutboundTunnelEndpoint {
_config = config; _config = config;
_processor = processor; _processor = processor;
_handler = new RouterFragmentHandler(ctx, new DefragmentedHandler()); _handler = new RouterFragmentHandler(ctx, new DefragmentedHandler());
_outDistributor = new OutboundMessageDistributor(ctx); _outDistributor = new OutboundMessageDistributor(ctx, 200);
} }
public void dispatch(TunnelDataMessage msg, Hash recvFrom) { public void dispatch(TunnelDataMessage msg, Hash recvFrom) {
_config.incrementProcessedMessages(); _config.incrementProcessedMessages();
...@@ -44,4 +44,4 @@ public class OutboundTunnelEndpoint { ...@@ -44,4 +44,4 @@ public class OutboundTunnelEndpoint {
_outDistributor.distribute(msg, toRouter, toTunnel); _outDistributor.distribute(msg, toRouter, toTunnel);
} }
} }
} }
\ No newline at end of file
...@@ -29,7 +29,7 @@ public class TunnelGatewayZeroHop extends TunnelGateway { ...@@ -29,7 +29,7 @@ public class TunnelGatewayZeroHop extends TunnelGateway {
if (config.isInbound()) if (config.isInbound())
_inDistributor = new InboundMessageDistributor(_context, config.getDestination()); _inDistributor = new InboundMessageDistributor(_context, config.getDestination());
else else
_outDistributor = new OutboundMessageDistributor(context); _outDistributor = new OutboundMessageDistributor(context, 400);
} }
/** /**
......
...@@ -157,7 +157,7 @@ public class TunnelParticipant { ...@@ -157,7 +157,7 @@ public class TunnelParticipant {
m.setMessage(msg); m.setMessage(msg);
m.setExpiration(msg.getMessageExpiration()); m.setExpiration(msg.getMessageExpiration());
m.setTarget(ri); m.setTarget(ri);
m.setPriority(400); m.setPriority(200);
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Forward on from " + _config + ": " + msg); _log.debug("Forward on from " + _config + ": " + msg);
_context.outNetMessagePool().add(m); _context.outNetMessagePool().add(m);
......
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