net.i2p.router.transport.udp deadwood code cleanup.
documented rare NPE in InboundEstablishState.java.
This commit is contained in:
@ -1,4 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
|
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
|
||||||
|
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
|
||||||
|
<file>file:/usblv/NetBeansProjects/i2p.i2p/apps/BOB/src/net/i2p/BOB/TCPio.java</file>
|
||||||
|
</open-files>
|
||||||
</project-private>
|
</project-private>
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2009-11-29 sponge
|
||||||
|
* net.i2p.router.transport.udp deadwood code cleanup.
|
||||||
|
* documented rare NPE in InboundEstablishState.java.
|
||||||
|
|
||||||
2009-11-28 sponge
|
2009-11-28 sponge
|
||||||
* Improvement to BOB's TCPio to hopefully lower load average. It seems
|
* Improvement to BOB's TCPio to hopefully lower load average. It seems
|
||||||
to be helping a little when stress-tested with Robert.
|
to be helping a little when stress-tested with Robert.
|
||||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 22;
|
public final static long BUILD = 23;
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
|
public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;
|
||||||
|
@ -46,7 +46,7 @@ public class InboundEstablishState {
|
|||||||
// general status
|
// general status
|
||||||
private long _establishBegin;
|
private long _establishBegin;
|
||||||
private long _lastReceive;
|
private long _lastReceive;
|
||||||
private long _lastSend;
|
// private long _lastSend;
|
||||||
private long _nextSend;
|
private long _nextSend;
|
||||||
private RemoteHostId _remoteHostId;
|
private RemoteHostId _remoteHostId;
|
||||||
private int _currentState;
|
private int _currentState;
|
||||||
@ -129,6 +129,7 @@ public class InboundEstablishState {
|
|||||||
|
|
||||||
public synchronized byte[] getSentY() {
|
public synchronized byte[] getSentY() {
|
||||||
if (_sentY == null)
|
if (_sentY == null)
|
||||||
|
// Rare NPE seen here...
|
||||||
_sentY = _keyBuilder.getMyPublicValueBytes();
|
_sentY = _keyBuilder.getMyPublicValueBytes();
|
||||||
return _sentY;
|
return _sentY;
|
||||||
}
|
}
|
||||||
@ -198,7 +199,7 @@ public class InboundEstablishState {
|
|||||||
|
|
||||||
/** note that we just sent a SessionCreated packet */
|
/** note that we just sent a SessionCreated packet */
|
||||||
public synchronized void createdPacketSent() {
|
public synchronized void createdPacketSent() {
|
||||||
_lastSend = _context.clock().now();
|
// _lastSend = _context.clock().now();
|
||||||
if ( (_currentState == STATE_UNKNOWN) || (_currentState == STATE_REQUEST_RECEIVED) )
|
if ( (_currentState == STATE_UNKNOWN) || (_currentState == STATE_REQUEST_RECEIVED) )
|
||||||
_currentState = STATE_CREATED_SENT;
|
_currentState = STATE_CREATED_SENT;
|
||||||
}
|
}
|
||||||
@ -210,8 +211,7 @@ public class InboundEstablishState {
|
|||||||
public synchronized void setNextSendTime(long when) { _nextSend = when; }
|
public synchronized void setNextSendTime(long when) { _nextSend = when; }
|
||||||
|
|
||||||
/** RemoteHostId, uniquely identifies an attempt */
|
/** RemoteHostId, uniquely identifies an attempt */
|
||||||
// FIXME Exporting non-public type through public API FIXME
|
RemoteHostId getRemoteHostId() { return _remoteHostId; }
|
||||||
public RemoteHostId getRemoteHostId() { return _remoteHostId; }
|
|
||||||
|
|
||||||
public synchronized void receiveSessionConfirmed(UDPPacketReader.SessionConfirmedReader conf) {
|
public synchronized void receiveSessionConfirmed(UDPPacketReader.SessionConfirmedReader conf) {
|
||||||
if (_receivedIdentity == null)
|
if (_receivedIdentity == null)
|
||||||
|
@ -157,8 +157,7 @@ public class IntroductionManager {
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME Exporting non-public type through public API FIXME */
|
void receiveRelayIntro(RemoteHostId bob, UDPPacketReader reader) {
|
||||||
public void receiveRelayIntro(RemoteHostId bob, UDPPacketReader reader) {
|
|
||||||
if (_context.router().isHidden())
|
if (_context.router().isHidden())
|
||||||
return;
|
return;
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
@ -167,8 +166,7 @@ public class IntroductionManager {
|
|||||||
_transport.send(_builder.buildHolePunch(reader));
|
_transport.send(_builder.buildHolePunch(reader));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME Exporting non-public type through public API FIXME */
|
void receiveRelayRequest(RemoteHostId alice, UDPPacketReader reader) {
|
||||||
public void receiveRelayRequest(RemoteHostId alice, UDPPacketReader reader) {
|
|
||||||
if (_context.router().isHidden())
|
if (_context.router().isHidden())
|
||||||
return;
|
return;
|
||||||
long tag = reader.getRelayRequestReader().readTag();
|
long tag = reader.getRelayRequestReader().readTag();
|
||||||
|
@ -413,8 +413,7 @@ public class OutboundEstablishState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** uniquely identifies an attempt */
|
/** uniquely identifies an attempt */
|
||||||
/* FIXME Exporting non-public type through public API FIXME */
|
RemoteHostId getRemoteHostId() { return _remoteHostId; }
|
||||||
public RemoteHostId getRemoteHostId() { return _remoteHostId; }
|
|
||||||
|
|
||||||
/** we have received a real data packet, so we're done establishing */
|
/** we have received a real data packet, so we're done establishing */
|
||||||
public synchronized void dataReceived() {
|
public synchronized void dataReceived() {
|
||||||
|
@ -26,7 +26,7 @@ public class OutboundMessageFragments {
|
|||||||
private RouterContext _context;
|
private RouterContext _context;
|
||||||
private Log _log;
|
private Log _log;
|
||||||
private UDPTransport _transport;
|
private UDPTransport _transport;
|
||||||
private ActiveThrottle _throttle; // LINT not used ??
|
// private ActiveThrottle _throttle; // LINT not used ??
|
||||||
/** peers we are actively sending messages to */
|
/** peers we are actively sending messages to */
|
||||||
private final List _activePeers;
|
private final List _activePeers;
|
||||||
private boolean _alive;
|
private boolean _alive;
|
||||||
@ -34,8 +34,8 @@ public class OutboundMessageFragments {
|
|||||||
private int _nextPeer;
|
private int _nextPeer;
|
||||||
private PacketBuilder _builder;
|
private PacketBuilder _builder;
|
||||||
/** if we can handle more messages explicitly, set this to true */
|
/** if we can handle more messages explicitly, set this to true */
|
||||||
private boolean _allowExcess; // LINT not used??
|
// private boolean _allowExcess; // LINT not used??
|
||||||
private volatile long _packetsRetransmitted; // LINT not used??
|
// private volatile long _packetsRetransmitted; // LINT not used??
|
||||||
|
|
||||||
// private static final int MAX_ACTIVE = 64; // not used.
|
// private static final int MAX_ACTIVE = 64; // not used.
|
||||||
// don't send a packet more than 10 times
|
// don't send a packet more than 10 times
|
||||||
@ -45,12 +45,12 @@ public class OutboundMessageFragments {
|
|||||||
_context = ctx;
|
_context = ctx;
|
||||||
_log = ctx.logManager().getLog(OutboundMessageFragments.class);
|
_log = ctx.logManager().getLog(OutboundMessageFragments.class);
|
||||||
_transport = transport;
|
_transport = transport;
|
||||||
_throttle = throttle;
|
// _throttle = throttle;
|
||||||
_activePeers = new ArrayList(256);
|
_activePeers = new ArrayList(256);
|
||||||
_nextPeer = 0;
|
_nextPeer = 0;
|
||||||
_builder = new PacketBuilder(ctx, transport);
|
_builder = new PacketBuilder(ctx, transport);
|
||||||
_alive = true;
|
_alive = true;
|
||||||
_allowExcess = false;
|
// _allowExcess = false;
|
||||||
_context.statManager().createRateStat("udp.sendVolleyTime", "Long it takes to send a full volley", "udp", UDPTransport.RATES);
|
_context.statManager().createRateStat("udp.sendVolleyTime", "Long it takes to send a full volley", "udp", UDPTransport.RATES);
|
||||||
_context.statManager().createRateStat("udp.sendConfirmTime", "How long it takes to send a message and get the ACK", "udp", UDPTransport.RATES);
|
_context.statManager().createRateStat("udp.sendConfirmTime", "How long it takes to send a message and get the ACK", "udp", UDPTransport.RATES);
|
||||||
_context.statManager().createRateStat("udp.sendConfirmFragments", "How many fragments are included in a fully ACKed message", "udp", UDPTransport.RATES);
|
_context.statManager().createRateStat("udp.sendConfirmFragments", "How many fragments are included in a fully ACKed message", "udp", UDPTransport.RATES);
|
||||||
@ -376,7 +376,7 @@ public class OutboundMessageFragments {
|
|||||||
if (state.getPushCount() > 1) {
|
if (state.getPushCount() > 1) {
|
||||||
int toSend = fragments-sparseCount;
|
int toSend = fragments-sparseCount;
|
||||||
peer.messageRetransmitted(toSend);
|
peer.messageRetransmitted(toSend);
|
||||||
_packetsRetransmitted += toSend; // lifetime for the transport
|
// _packetsRetransmitted += toSend; // lifetime for the transport
|
||||||
_context.statManager().addRateData("udp.peerPacketsRetransmitted", peer.getPacketsRetransmitted(), peer.getPacketsTransmitted());
|
_context.statManager().addRateData("udp.peerPacketsRetransmitted", peer.getPacketsRetransmitted(), peer.getPacketsTransmitted());
|
||||||
_context.statManager().addRateData("udp.packetsRetransmitted", state.getLifetime(), peer.getPacketsTransmitted());
|
_context.statManager().addRateData("udp.packetsRetransmitted", state.getLifetime(), peer.getPacketsTransmitted());
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
|
@ -32,7 +32,7 @@ public class OutboundMessageState {
|
|||||||
private long _nextSendTime;
|
private long _nextSendTime;
|
||||||
private int _pushCount;
|
private int _pushCount;
|
||||||
private short _maxSends;
|
private short _maxSends;
|
||||||
private int _nextSendFragment;
|
// private int _nextSendFragment;
|
||||||
|
|
||||||
public static final int MAX_MSG_SIZE = 32 * 1024;
|
public static final int MAX_MSG_SIZE = 32 * 1024;
|
||||||
/** is this enough for a high-bandwidth router? */
|
/** is this enough for a high-bandwidth router? */
|
||||||
@ -45,7 +45,7 @@ public class OutboundMessageState {
|
|||||||
_log = _context.logManager().getLog(OutboundMessageState.class);
|
_log = _context.logManager().getLog(OutboundMessageState.class);
|
||||||
_pushCount = 0;
|
_pushCount = 0;
|
||||||
_maxSends = 0;
|
_maxSends = 0;
|
||||||
_nextSendFragment = 0;
|
// _nextSendFragment = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean initialize(OutNetMessage msg) {
|
public boolean initialize(OutNetMessage msg) {
|
||||||
|
@ -16,14 +16,14 @@ public class OutboundRefiller implements Runnable {
|
|||||||
private OutboundMessageFragments _fragments;
|
private OutboundMessageFragments _fragments;
|
||||||
private MessageQueue _messages;
|
private MessageQueue _messages;
|
||||||
private boolean _alive;
|
private boolean _alive;
|
||||||
private Object _refillLock;
|
// private Object _refillLock;
|
||||||
|
|
||||||
public OutboundRefiller(RouterContext ctx, OutboundMessageFragments fragments, MessageQueue messages) {
|
public OutboundRefiller(RouterContext ctx, OutboundMessageFragments fragments, MessageQueue messages) {
|
||||||
_context = ctx;
|
_context = ctx;
|
||||||
_log = ctx.logManager().getLog(OutboundRefiller.class);
|
_log = ctx.logManager().getLog(OutboundRefiller.class);
|
||||||
_fragments = fragments;
|
_fragments = fragments;
|
||||||
_messages = messages;
|
_messages = messages;
|
||||||
_refillLock = this;
|
// _refillLock = this;
|
||||||
_context.statManager().createRateStat("udp.timeToActive", "Message lifetime until it reaches the outbound fragment queue", "udp", UDPTransport.RATES);
|
_context.statManager().createRateStat("udp.timeToActive", "Message lifetime until it reaches the outbound fragment queue", "udp", UDPTransport.RATES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,8 +879,7 @@ public class PacketBuilder {
|
|||||||
*/
|
*/
|
||||||
private static final byte PEER_RELAY_INTRO_FLAG_BYTE = (UDPPacket.PAYLOAD_TYPE_RELAY_INTRO << 4);
|
private static final byte PEER_RELAY_INTRO_FLAG_BYTE = (UDPPacket.PAYLOAD_TYPE_RELAY_INTRO << 4);
|
||||||
|
|
||||||
/* FIXME Exporting non-public type through public API FIXME */
|
UDPPacket buildRelayIntro(RemoteHostId alice, PeerState charlie, UDPPacketReader.RelayRequestReader request) {
|
||||||
public UDPPacket buildRelayIntro(RemoteHostId alice, PeerState charlie, UDPPacketReader.RelayRequestReader request) {
|
|
||||||
UDPPacket packet = UDPPacket.acquire(_context, false);
|
UDPPacket packet = UDPPacket.acquire(_context, false);
|
||||||
byte data[] = packet.getPacket().getData();
|
byte data[] = packet.getPacket().getData();
|
||||||
Arrays.fill(data, 0, data.length, (byte)0x0);
|
Arrays.fill(data, 0, data.length, (byte)0x0);
|
||||||
@ -930,8 +929,7 @@ public class PacketBuilder {
|
|||||||
*/
|
*/
|
||||||
private static final byte PEER_RELAY_RESPONSE_FLAG_BYTE = (UDPPacket.PAYLOAD_TYPE_RELAY_RESPONSE << 4);
|
private static final byte PEER_RELAY_RESPONSE_FLAG_BYTE = (UDPPacket.PAYLOAD_TYPE_RELAY_RESPONSE << 4);
|
||||||
|
|
||||||
/* FIXME Exporting non-public type through public API FIXME */
|
UDPPacket buildRelayResponse(RemoteHostId alice, PeerState charlie, long nonce, SessionKey aliceIntroKey) {
|
||||||
public UDPPacket buildRelayResponse(RemoteHostId alice, PeerState charlie, long nonce, SessionKey aliceIntroKey) {
|
|
||||||
InetAddress aliceAddr = null;
|
InetAddress aliceAddr = null;
|
||||||
try {
|
try {
|
||||||
aliceAddr = InetAddress.getByAddress(alice.getIP());
|
aliceAddr = InetAddress.getByAddress(alice.getIP());
|
||||||
|
@ -36,8 +36,7 @@ public class PacketHandler {
|
|||||||
/** let packets be up to 30s slow */
|
/** let packets be up to 30s slow */
|
||||||
private static final long GRACE_PERIOD = Router.CLOCK_FUDGE_FACTOR + 30*1000;
|
private static final long GRACE_PERIOD = Router.CLOCK_FUDGE_FACTOR + 30*1000;
|
||||||
|
|
||||||
/* FIXME Exporting non-public type through public API FIXME */
|
PacketHandler(RouterContext ctx, UDPTransport transport, UDPEndpoint endpoint, EstablishmentManager establisher, InboundMessageFragments inbound, PeerTestManager testManager, IntroductionManager introManager) {// LINT -- Exporting non-public type through public API
|
||||||
public PacketHandler(RouterContext ctx, UDPTransport transport, UDPEndpoint endpoint, EstablishmentManager establisher, InboundMessageFragments inbound, PeerTestManager testManager, IntroductionManager introManager) {// LINT -- Exporting non-public type through public API
|
|
||||||
_context = ctx;
|
_context = ctx;
|
||||||
_log = ctx.logManager().getLog(PacketHandler.class);
|
_log = ctx.logManager().getLog(PacketHandler.class);
|
||||||
_transport = transport;
|
_transport = transport;
|
||||||
|
@ -10,14 +10,14 @@ import net.i2p.util.Log;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class PacketPusher implements Runnable {
|
public class PacketPusher implements Runnable {
|
||||||
private RouterContext _context;
|
// private RouterContext _context;
|
||||||
private Log _log;
|
private Log _log;
|
||||||
private OutboundMessageFragments _fragments;
|
private OutboundMessageFragments _fragments;
|
||||||
private UDPSender _sender;
|
private UDPSender _sender;
|
||||||
private boolean _alive;
|
private boolean _alive;
|
||||||
|
|
||||||
public PacketPusher(RouterContext ctx, OutboundMessageFragments fragments, UDPSender sender) {
|
public PacketPusher(RouterContext ctx, OutboundMessageFragments fragments, UDPSender sender) {
|
||||||
_context = ctx;
|
// _context = ctx;
|
||||||
_log = ctx.logManager().getLog(PacketPusher.class);
|
_log = ctx.logManager().getLog(PacketPusher.class);
|
||||||
_fragments = fragments;
|
_fragments = fragments;
|
||||||
_sender = sender;
|
_sender = sender;
|
||||||
|
@ -72,7 +72,7 @@ public class PeerState {
|
|||||||
/** how many consecutive messages have we sent and not received an ACK to */
|
/** how many consecutive messages have we sent and not received an ACK to */
|
||||||
private int _consecutiveFailedSends;
|
private int _consecutiveFailedSends;
|
||||||
/** when did we last have a failed send (beginning of period) */
|
/** when did we last have a failed send (beginning of period) */
|
||||||
private long _lastFailedSendPeriod;
|
// private long _lastFailedSendPeriod;
|
||||||
/** list of messageIds (Long) that we have received but not yet sent */
|
/** list of messageIds (Long) that we have received but not yet sent */
|
||||||
private final List _currentACKs;
|
private final List _currentACKs;
|
||||||
/**
|
/**
|
||||||
@ -805,7 +805,7 @@ public class PeerState {
|
|||||||
_concurrentMessagesActive = 0;
|
_concurrentMessagesActive = 0;
|
||||||
|
|
||||||
_consecutiveFailedSends = 0;
|
_consecutiveFailedSends = 0;
|
||||||
_lastFailedSendPeriod = -1;
|
// _lastFailedSendPeriod = -1;
|
||||||
if (numSends < 2) {
|
if (numSends < 2) {
|
||||||
if (_context.random().nextInt(_concurrentMessagesAllowed) <= 0)
|
if (_context.random().nextInt(_concurrentMessagesAllowed) <= 0)
|
||||||
_concurrentMessagesAllowed++;
|
_concurrentMessagesAllowed++;
|
||||||
@ -1003,8 +1003,7 @@ public class PeerState {
|
|||||||
return MAX_RTO;
|
return MAX_RTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME Exporting non-public type through public API FIXME */
|
RemoteHostId getRemoteHostId() { return _remoteHostId; }
|
||||||
public RemoteHostId getRemoteHostId() { return _remoteHostId; }
|
|
||||||
|
|
||||||
public int add(OutboundMessageState state) {
|
public int add(OutboundMessageState state) {
|
||||||
if (_dead) {
|
if (_dead) {
|
||||||
|
@ -4,7 +4,6 @@ import java.net.DatagramSocket;
|
|||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.SocketException;
|
import java.net.SocketException;
|
||||||
|
|
||||||
import net.i2p.router.CommSystemFacade;
|
|
||||||
import net.i2p.router.RouterContext;
|
import net.i2p.router.RouterContext;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
|
||||||
|
@ -9,14 +9,14 @@ import net.i2p.data.i2np.I2NPMessage;
|
|||||||
import net.i2p.router.OutNetMessage;
|
import net.i2p.router.OutNetMessage;
|
||||||
import net.i2p.router.RouterContext;
|
import net.i2p.router.RouterContext;
|
||||||
import net.i2p.util.I2PThread;
|
import net.i2p.util.I2PThread;
|
||||||
import net.i2p.util.Log;
|
// import net.i2p.util.Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class UDPFlooder implements Runnable {
|
class UDPFlooder implements Runnable {
|
||||||
private RouterContext _context;
|
private RouterContext _context;
|
||||||
private Log _log;
|
// private Log _log;
|
||||||
private UDPTransport _transport;
|
private UDPTransport _transport;
|
||||||
private final List _peers;
|
private final List _peers;
|
||||||
private boolean _alive;
|
private boolean _alive;
|
||||||
@ -24,7 +24,7 @@ class UDPFlooder implements Runnable {
|
|||||||
|
|
||||||
public UDPFlooder(RouterContext ctx, UDPTransport transport) {
|
public UDPFlooder(RouterContext ctx, UDPTransport transport) {
|
||||||
_context = ctx;
|
_context = ctx;
|
||||||
_log = ctx.logManager().getLog(UDPFlooder.class);
|
// _log = ctx.logManager().getLog(UDPFlooder.class);
|
||||||
_transport = transport;
|
_transport = transport;
|
||||||
_peers = new ArrayList(4);
|
_peers = new ArrayList(4);
|
||||||
ctx.random().nextBytes(_floodData);
|
ctx.random().nextBytes(_floodData);
|
||||||
|
@ -38,7 +38,7 @@ public class UDPPacket {
|
|||||||
private long _beforeReceiveFragments;
|
private long _beforeReceiveFragments;
|
||||||
private long _afterHandlingTime;
|
private long _afterHandlingTime;
|
||||||
private int _validateCount;
|
private int _validateCount;
|
||||||
private boolean _isInbound;
|
// private boolean _isInbound;
|
||||||
|
|
||||||
private static final List _packetCache;
|
private static final List _packetCache;
|
||||||
static {
|
static {
|
||||||
@ -83,13 +83,14 @@ public class UDPPacket {
|
|||||||
_ivBuf = new byte[IV_SIZE];
|
_ivBuf = new byte[IV_SIZE];
|
||||||
init(ctx, inbound);
|
init(ctx, inbound);
|
||||||
}
|
}
|
||||||
|
// FIXME optimization, remove the inbound parameter, as it is unused. FIXME
|
||||||
private void init(I2PAppContext ctx, boolean inbound) {
|
private void init(I2PAppContext ctx, boolean inbound) {
|
||||||
_context = ctx;
|
_context = ctx;
|
||||||
//_dataBuf = _dataCache.acquire();
|
//_dataBuf = _dataCache.acquire();
|
||||||
Arrays.fill(_data, (byte)0);
|
Arrays.fill(_data, (byte)0);
|
||||||
//_packet = new DatagramPacket(_data, MAX_PACKET_SIZE);
|
//_packet = new DatagramPacket(_data, MAX_PACKET_SIZE);
|
||||||
_packet.setData(_data);
|
_packet.setData(_data);
|
||||||
_isInbound = inbound;
|
// _isInbound = inbound;
|
||||||
_initializeTime = _context.clock().now();
|
_initializeTime = _context.clock().now();
|
||||||
_markedType = -1;
|
_markedType = -1;
|
||||||
_validateCount = 0;
|
_validateCount = 0;
|
||||||
@ -125,8 +126,7 @@ public class UDPPacket {
|
|||||||
int getFragmentCount() { return _fragmentCount; }
|
int getFragmentCount() { return _fragmentCount; }
|
||||||
void setFragmentCount(int count) { _fragmentCount = count; }
|
void setFragmentCount(int count) { _fragmentCount = count; }
|
||||||
|
|
||||||
// FIXME Exporting non-public type through public API FIXME
|
RemoteHostId getRemoteHost() {
|
||||||
public RemoteHostId getRemoteHost() {
|
|
||||||
if (_remoteHost == null) {
|
if (_remoteHost == null) {
|
||||||
long before = System.currentTimeMillis();
|
long before = System.currentTimeMillis();
|
||||||
InetAddress addr = _packet.getAddress();
|
InetAddress addr = _packet.getAddress();
|
||||||
|
@ -28,7 +28,7 @@ public class UDPReceiver {
|
|||||||
private boolean _keepRunning;
|
private boolean _keepRunning;
|
||||||
private Runner _runner;
|
private Runner _runner;
|
||||||
private UDPTransport _transport;
|
private UDPTransport _transport;
|
||||||
private static int __id;
|
// private static int __id;
|
||||||
private int _id;
|
private int _id;
|
||||||
|
|
||||||
public UDPReceiver(RouterContext ctx, UDPTransport transport, DatagramSocket socket, String name) {
|
public UDPReceiver(RouterContext ctx, UDPTransport transport, DatagramSocket socket, String name) {
|
||||||
|
@ -3,7 +3,6 @@ package net.i2p.router.transport.udp;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.SocketException;
|
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -545,8 +544,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
* get the state for the peer at the given remote host/port, or null
|
* get the state for the peer at the given remote host/port, or null
|
||||||
* if no state exists
|
* if no state exists
|
||||||
*/
|
*/
|
||||||
/* FIXME Exporting non-public type through public API FIXME */
|
PeerState getPeerState(RemoteHostId hostInfo) {
|
||||||
public PeerState getPeerState(RemoteHostId hostInfo) {
|
|
||||||
synchronized (_peersByRemoteHost) {
|
synchronized (_peersByRemoteHost) {
|
||||||
return (PeerState)_peersByRemoteHost.get(hostInfo);
|
return (PeerState)_peersByRemoteHost.get(hostInfo);
|
||||||
}
|
}
|
||||||
@ -783,8 +781,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME Exporting non-public type through public API FIXME */
|
boolean isInDropList(RemoteHostId peer) { synchronized (_dropList) { return _dropList.contains(peer); } }
|
||||||
public boolean isInDropList(RemoteHostId peer) { synchronized (_dropList) { return _dropList.contains(peer); } }
|
|
||||||
|
|
||||||
void dropPeer(Hash peer, boolean shouldShitlist, String why) {
|
void dropPeer(Hash peer, boolean shouldShitlist, String why) {
|
||||||
PeerState state = getPeerState(peer);
|
PeerState state = getPeerState(peer);
|
||||||
@ -2235,8 +2232,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
|||||||
_testEvent.runTest();
|
_testEvent.runTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME Exporting non-public type through public API FIXME */
|
PeerState pickTestPeer(RemoteHostId dontInclude) {
|
||||||
public PeerState pickTestPeer(RemoteHostId dontInclude) {
|
|
||||||
List peers = null;
|
List peers = null;
|
||||||
synchronized (_peersByIdent) {
|
synchronized (_peersByIdent) {
|
||||||
peers = new ArrayList(_peersByIdent.values());
|
peers = new ArrayList(_peersByIdent.values());
|
||||||
|
Reference in New Issue
Block a user