Changeset bd82a0c


Ignore:
Timestamp:
Dec 6, 2011 9:49:23 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
be1d95e
Parents:
0f384c8
Message:

increase next hop send timeout; log tweaks

Location:
router/java/src/net/i2p/router/tunnel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/tunnel/HopConfig.java

    r0f384c8 rbd82a0c  
    149149            buf.append("recv on ");
    150150            buf.append(DataHelper.fromLong(_receiveTunnelId, 0, 4));
    151             buf.append(" ");
     151            buf.append(' ');
    152152        }
    153153       
     
    158158        }
    159159       
    160         buf.append(" expiring on ").append(TunnelCreatorConfig.format(_expiration));
    161         buf.append(" having transferred ").append(_messagesProcessed).append("KB");
     160        buf.append(" exp. ").append(TunnelCreatorConfig.format(_expiration));
     161        if (_messagesProcessed > 0)
     162            buf.append(" used ").append(_messagesProcessed).append("KB");
    162163        return buf.toString();
    163164    }
  • router/java/src/net/i2p/router/tunnel/TunnelCreatorConfig.java

    r0f384c8 rbd82a0c  
    209209        StringBuilder buf = new StringBuilder(128);
    210210        if (_isInbound)
    211             buf.append("inbound");
     211            buf.append("IB");
    212212        else
    213             buf.append("outbound");
     213            buf.append("OB");
    214214        if (_destination == null)
    215             buf.append(" exploratory");
    216         buf.append(": ");
     215            buf.append(" expl");
     216        else
     217            buf.append(" client ").append(Base64.encode(_destination.getData(), 0, 3));
     218        buf.append(": GW ");
    217219        for (int i = 0; i < _peers.length; i++) {
    218220            buf.append(_peers[i].toBase64().substring(0,4));
     
    221223                buf.append(_config[i].getReceiveTunnel());
    222224            else
    223                 buf.append('x');
     225                buf.append("me");
    224226            buf.append('.');
    225227            if (_config[i].getSendTunnel() != null)
    226228                buf.append(_config[i].getSendTunnel());
    227229            else
    228                 buf.append('x');
     230                buf.append("me");
    229231            if (i + 1 < _peers.length)
    230                 buf.append("...");
     232                buf.append("-->");
    231233        }
    232234       
    233         buf.append(" expiring on ").append(getExpirationString());
    234         if (_destination != null)
    235             buf.append(" for ").append(Base64.encode(_destination.getData(), 0, 3));
     235        buf.append(" exp. ").append(getExpirationString());
    236236        if (_replyMessageId > 0)
    237             buf.append(" replyMessageId ").append(_replyMessageId);
    238         buf.append(" with ").append(_messagesProcessed).append("/").append(_verifiedBytesTransferred).append(" msgs/bytes");
    239    
    240         buf.append(" with ").append(_failures).append(" failures");
     237            buf.append(" replyMsgID ").append(_replyMessageId);
     238        if (_messagesProcessed > 0)
     239            buf.append(" with ").append(_messagesProcessed).append("/").append(_verifiedBytesTransferred).append(" msgs/bytes");
     240   
     241        if (_failures > 0)
     242            buf.append(" with ").append(_failures).append(" failures");
    241243        return buf.toString();
    242244    }
  • router/java/src/net/i2p/router/tunnel/TunnelDispatcher.java

    r0f384c8 rbd82a0c  
    266266    public void joinOutboundEndpoint(HopConfig cfg) {
    267267        if (_log.shouldLog(Log.INFO))
    268             _log.info("Joining as outbound endpoint: " + cfg);
     268            _log.info("Joining as OBEP: " + cfg);
    269269        TunnelId recvId = cfg.getReceiveTunnel();
    270270        OutboundTunnelEndpoint endpoint = new OutboundTunnelEndpoint(_context, cfg, new HopProcessor(_context, cfg, _validator));
     
    285285    public void joinInboundGateway(HopConfig cfg) {
    286286        if (_log.shouldLog(Log.INFO))
    287             _log.info("Joining as inbound gateway: " + cfg);
     287            _log.info("Joining as IBGW: " + cfg);
    288288        TunnelGateway.QueuePreprocessor preproc = createPreprocessor(cfg);
    289289        TunnelGateway.Sender sender = new InboundSender(_context, cfg);
     
    364364    public void remove(HopConfig cfg) {
    365365        TunnelId recvId = cfg.getReceiveTunnel();
    366         if (_log.shouldLog(Log.DEBUG))
    367             _log.debug("removing " + cfg);
    368366       
    369367        boolean removed = (null != _participatingConfig.remove(recvId));
    370         if (!removed) {
    371             if (_log.shouldLog(Log.INFO))
    372                 _log.info("Participating tunnel, but no longer listed in participatingConfig? " + cfg);
     368        if (removed) {
     369            if (_log.shouldLog(Log.DEBUG))
     370                _log.debug("removing " + cfg, new Exception());
     371        } else {
     372            // this is normal, this can get called twice
     373            if (_log.shouldLog(Log.DEBUG))
     374                _log.debug("Participating tunnel, but no longer listed in participatingConfig? " + cfg, new Exception());
    373375        }
    374376       
     
    838840                if (exp < now) {
    839841                    _configs.poll();
     842                    if (_log.shouldLog(Log.INFO))
     843                        _log.info("Expiring " + cur);
    840844                    remove(cur);
    841845                } else {
  • router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java

    r0f384c8 rbd82a0c  
    6161    private static final int MAX_QUEUE = 192;
    6262
     63    private static final int NEXT_HOP_LOOKUP_TIMEOUT = 15*1000;
     64   
     65    /**
     66     *  This must be high, as if we timeout the send we remove the tunnel from
     67     *  participating via OnFailedSendJob.
     68     *  If them msg actually got through then we will be dropping
     69     *  all the traffic in TunnelDispatcher.dispatch(TunnelDataMessage msg, Hash recvFrom).
     70     *  10s was not enough.
     71     */
     72    private static final int NEXT_HOP_SEND_TIMEOUT = 15*1000;
     73
    6374    public BuildHandler(RouterContext ctx, TunnelPoolManager manager, BuildExecutor exec) {
    6475        _context = ctx;
     
    110121        ctx.inNetMessagePool().registerHandlerJobBuilder(VariableTunnelBuildReplyMessage.MESSAGE_TYPE, tbrmhjb);
    111122    }
    112    
    113     private static final int NEXT_HOP_LOOKUP_TIMEOUT = 15*1000;
    114123   
    115124    /**
     
    651660        if (!isOutEnd) {
    652661            state.msg.setUniqueId(req.readReplyMessageId());
    653             state.msg.setMessageExpiration(_context.clock().now() + 10*1000);
     662            state.msg.setMessageExpiration(_context.clock().now() + NEXT_HOP_SEND_TIMEOUT);
    654663            OutNetMessage msg = new OutNetMessage(_context);
    655664            msg.setMessage(state.msg);
     
    661670            _context.outNetMessagePool().add(msg);
    662671        } else {
     672            // We are the OBEP.
    663673            // send it to the reply tunnel on the reply peer within a new TunnelBuildReplyMessage
    664674            // (enough layers jrandom?)
     
    671681                replyMsg.setRecord(i, state.msg.getRecord(i));
    672682            replyMsg.setUniqueId(req.readReplyMessageId());
    673             replyMsg.setMessageExpiration(_context.clock().now() + 10*1000);
     683            replyMsg.setMessageExpiration(_context.clock().now() + NEXT_HOP_SEND_TIMEOUT);
    674684            TunnelGatewayMessage m = new TunnelGatewayMessage(_context);
    675685            m.setMessage(replyMsg);
     
    864874     */
    865875    private static class TunnelBuildNextHopFailJob extends JobImpl {
    866         final HopConfig _cfg;
     876        private final HopConfig _cfg;
     877
    867878        private TunnelBuildNextHopFailJob(RouterContext ctx, HopConfig cfg) {
    868879            super(ctx);
    869880            _cfg = cfg;
    870881        }
     882
    871883        public String getName() { return "Timeout contacting next peer for tunnel join"; }
     884
    872885        public void runJob() {
    873886            getContext().tunnelDispatcher().remove(_cfg);
    874887            getContext().statManager().addRateData("tunnel.rejectTimeout2", 1, 0);
    875             // static, no _log
    876             //_log.error("Cant contact next hop for " + _cfg);
     888            Log log = getContext().logManager().getLog(BuildHandler.class);
     889            if (log.shouldLog(Log.WARN))
     890                log.warn("Timeout contacting next hop for " + _cfg);
    877891        }
    878892    }
Note: See TracChangeset for help on using the changeset viewer.