Hopefully fix SSU NPE (ticket #967)

This commit is contained in:
zzz
2013-07-06 13:25:11 +00:00
parent 3aafea0d98
commit aabbdc1c1b

View File

@ -69,7 +69,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
private final OutboundMessageFragments _fragments; private final OutboundMessageFragments _fragments;
private final OutboundMessageFragments.ActiveThrottle _activeThrottle; private final OutboundMessageFragments.ActiveThrottle _activeThrottle;
private OutboundRefiller _refiller; private OutboundRefiller _refiller;
private PacketPusher _pusher; private volatile PacketPusher _pusher;
private final InboundMessageFragments _inboundFragments; private final InboundMessageFragments _inboundFragments;
//private UDPFlooder _flooder; //private UDPFlooder _flooder;
private PeerTestManager _testManager; private PeerTestManager _testManager;
@ -423,12 +423,13 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
_context.router().saveConfig(changes, null); _context.router().saveConfig(changes, null);
} }
_establisher.startup();
_handler.startup(); _handler.startup();
_fragments.startup(); _fragments.startup();
_inboundFragments.startup(); _inboundFragments.startup();
_pusher = new PacketPusher(_context, _fragments, _endpoints); _pusher = new PacketPusher(_context, _fragments, _endpoints);
_pusher.startup(); _pusher.startup();
// must be after pusher
_establisher.startup();
if (USE_PRIORITY) if (USE_PRIORITY)
_refiller.startup(); _refiller.startup();
//if (SHOULD_FLOOD_PEERS) //if (SHOULD_FLOOD_PEERS)
@ -1413,14 +1414,18 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
} }
/** /**
* This sends it directly out, bypassing OutboundMessageFragments * This sends it directly out, bypassing OutboundMessageFragments.
* and the PacketPusher. The only queueing is for the bandwidth limiter. * The only queueing is for the bandwidth limiter.
* BLOCKING if OB queue is full. * BLOCKING if OB queue is full.
*/ */
void send(UDPPacket packet) { void send(UDPPacket packet) {
if (_log.shouldLog(Log.DEBUG)) if (_pusher != null) {
_log.debug("Sending packet " + packet); if (_log.shouldLog(Log.DEBUG))
_pusher.send(packet); _log.debug("Sending packet " + packet);
_pusher.send(packet);
} else {
_log.error("No pusher", new Exception());
}
} }
/** /**