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);
if (msg == null)
throw new IllegalArgumentException("wtf, null message? sod off");
if (tunnelId == null)
throw new IllegalArgumentException("wtf, no tunnelId? nuh uh");
_message = msg;
_destRouter = targetRouter;
_tunnelId = tunnelId;

View File

@ -80,10 +80,16 @@ public class HandleDatabaseStoreMessageJob extends JobImpl {
msg.setMessageId(_message.getReplyToken());
msg.setArrival(new Date(getContext().clock().now()));
TunnelId outTunnelId = selectOutboundTunnel();
if (outTunnelId == null) {
if (_log.shouldLog(Log.WARN))
_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() {
TunnelSelectionCriteria criteria = new TunnelSelectionCriteria();