deal with not having tunnels a bit earlier

This commit is contained in:
jrandom
2004-07-25 23:51:07 +00:00
committed by zzz
parent edaf7aee5d
commit 9218f7b82c
2 changed files with 11 additions and 3 deletions

View File

@ -64,6 +64,8 @@ public class SendTunnelMessageJob extends JobImpl {
_log = ctx.logManager().getLog(SendTunnelMessageJob.class); _log = ctx.logManager().getLog(SendTunnelMessageJob.class);
if (msg == null) if (msg == null)
throw new IllegalArgumentException("wtf, null message? sod off"); throw new IllegalArgumentException("wtf, null message? sod off");
if (tunnelId == null)
throw new IllegalArgumentException("wtf, no tunnelId? nuh uh");
_message = msg; _message = msg;
_destRouter = targetRouter; _destRouter = targetRouter;
_tunnelId = tunnelId; _tunnelId = tunnelId;

View File

@ -80,9 +80,15 @@ public class HandleDatabaseStoreMessageJob extends JobImpl {
msg.setMessageId(_message.getReplyToken()); msg.setMessageId(_message.getReplyToken());
msg.setArrival(new Date(getContext().clock().now())); msg.setArrival(new Date(getContext().clock().now()));
TunnelId outTunnelId = selectOutboundTunnel(); TunnelId outTunnelId = selectOutboundTunnel();
getContext().jobQueue().addJob(new SendTunnelMessageJob(getContext(), msg, outTunnelId, if (outTunnelId == null) {
_message.getReplyGateway(), _message.getReplyTunnel(), if (_log.shouldLog(Log.WARN))
null, null, null, null, ACK_TIMEOUT, ACK_PRIORITY)); _log.warn("No outbound tunnel could be found");
return;
} else {
getContext().jobQueue().addJob(new SendTunnelMessageJob(getContext(), msg, outTunnelId,
_message.getReplyGateway(), _message.getReplyTunnel(),
null, null, null, null, ACK_TIMEOUT, ACK_PRIORITY));
}
} }
private TunnelId selectOutboundTunnel() { private TunnelId selectOutboundTunnel() {