Changeset 0ed88c5


Ignore:
Timestamp:
Jan 16, 2011 3:30:41 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
5a1027c5
Parents:
32b817f
Message:
  • UDP: Prevent rare startup NPE
File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/transport/udp/UDPTransport.java

    r32b817f r0ed88c5  
    5353    private EstablishmentManager _establisher;
    5454    private final MessageQueue _outboundMessages;
    55     private OutboundMessageFragments _fragments;
     55    private final OutboundMessageFragments _fragments;
    5656    private final OutboundMessageFragments.ActiveThrottle _activeThrottle;
    5757    private OutboundRefiller _refiller;
    5858    private PacketPusher _pusher;
    59     private InboundMessageFragments _inboundFragments;
     59    private final InboundMessageFragments _inboundFragments;
    6060    private UDPFlooder _flooder;
    6161    private PeerTestManager _testManager;
    6262    private final IntroductionManager _introManager;
    63     private ExpirePeerEvent _expireEvent;
    64     private PeerTestEvent _testEvent;
     63    private final ExpirePeerEvent _expireEvent;
     64    private final PeerTestEvent _testEvent;
    6565    private short _reachabilityStatus;
    6666    private long _reachabilityStatusLastUpdated;
     
    228228   
    229229    public void startup() {
    230         if (_fragments != null)
    231             _fragments.shutdown();
     230        _fragments.shutdown();
    232231        if (_pusher != null)
    233232            _pusher.shutdown();
     
    240239        if (_refiller != null)
    241240            _refiller.shutdown();
    242         if (_inboundFragments != null)
    243             _inboundFragments.shutdown();
     241        _inboundFragments.shutdown();
    244242        if (_flooder != null)
    245243            _flooder.shutdown();
     
    346344        if (_handler != null)
    347345            _handler.shutdown();
    348         if (_fragments != null)
    349             _fragments.shutdown();
     346        _fragments.shutdown();
    350347        if (_pusher != null)
    351348            _pusher.shutdown();
    352349        if (_establisher != null)
    353350            _establisher.shutdown();
    354         if (_inboundFragments != null)
    355             _inboundFragments.shutdown();
     351        _inboundFragments.shutdown();
    356352        _expireEvent.setIsAlive(false);
    357353        _testEvent.setIsAlive(false);
     
    11171113        if (msg.getTarget() == null) return;
    11181114        if (msg.getTarget().getIdentity() == null) return;
    1119    
     1115        if (_establisher == null) {
     1116            failed(msg, "UDP not up yet");
     1117            return;   
     1118        }
     1119
    11201120        msg.timestamp("sending on UDP transport");
    11211121        Hash to = msg.getTarget().getIdentity().calculateHash();
     
    14441444            _log.info("Sending message failed: " + msg, new Exception("failed from"));
    14451445       
    1446         if (!_context.messageHistory().getDoLog())
     1446        if (_context.messageHistory().getDoLog())
    14471447            _context.messageHistory().sendMessage(msg.getMessageType(), msg.getMessageId(), msg.getExpiration(),
    14481448                                              msg.getTarget().getIdentity().calculateHash(), false, reason);
    14491449        super.afterSend(msg, false);
    14501450    }
     1451
    14511452    public void succeeded(OutboundMessageState msg) {
    14521453        if (msg == null) return;
Note: See TracChangeset for help on using the changeset viewer.