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

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

* ClientConnectionRunner: Run MessageReceivedJob inline for speed

parent 1ae0c2e3
No related branches found
No related tags found
No related merge requests found
...@@ -375,7 +375,9 @@ class ClientConnectionRunner { ...@@ -375,7 +375,9 @@ class ClientConnectionRunner {
void receiveMessage(Destination toDest, Destination fromDest, Payload payload) { void receiveMessage(Destination toDest, Destination fromDest, Payload payload) {
if (_dead) return; if (_dead) return;
MessageReceivedJob j = new MessageReceivedJob(_context, this, toDest, fromDest, payload); MessageReceivedJob j = new MessageReceivedJob(_context, this, toDest, fromDest, payload);
_context.jobQueue().addJob(j);//j.runJob(); // This is fast and non-blocking, run in-line
//_context.jobQueue().addJob(j);
j.runJob();
} }
/** /**
......
...@@ -25,6 +25,7 @@ class MessageReceivedJob extends JobImpl { ...@@ -25,6 +25,7 @@ class MessageReceivedJob extends JobImpl {
private final Log _log; private final Log _log;
private final ClientConnectionRunner _runner; private final ClientConnectionRunner _runner;
private final Payload _payload; private final Payload _payload;
public MessageReceivedJob(RouterContext ctx, ClientConnectionRunner runner, Destination toDest, Destination fromDest, Payload payload) { public MessageReceivedJob(RouterContext ctx, ClientConnectionRunner runner, Destination toDest, Destination fromDest, Payload payload) {
super(ctx); super(ctx);
_log = ctx.logManager().getLog(MessageReceivedJob.class); _log = ctx.logManager().getLog(MessageReceivedJob.class);
...@@ -33,6 +34,7 @@ class MessageReceivedJob extends JobImpl { ...@@ -33,6 +34,7 @@ class MessageReceivedJob extends JobImpl {
} }
public String getName() { return "Deliver New Message"; } public String getName() { return "Deliver New Message"; }
public void runJob() { public void runJob() {
if (_runner.isDead()) return; if (_runner.isDead()) return;
MessageId id = new MessageId(); MessageId id = new MessageId();
...@@ -44,7 +46,7 @@ class MessageReceivedJob extends JobImpl { ...@@ -44,7 +46,7 @@ class MessageReceivedJob extends JobImpl {
/** /**
* Deliver notification to the client that the given message is available. * Deliver notification to the client that the given message is available.
*/ */
public void messageAvailable(MessageId id, long size) { private void messageAvailable(MessageId id, long size) {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Sending message available: " + id + " to sessionId " + _runner.getSessionId() _log.debug("Sending message available: " + id + " to sessionId " + _runner.getSessionId()
+ " (with nonce=1)", new Exception("available")); + " (with nonce=1)", new Exception("available"));
......
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