cleanups and comments

This commit is contained in:
zzz
2011-07-23 16:55:44 +00:00
parent 01b4b227ae
commit 3466dc1099
5 changed files with 18 additions and 8 deletions

View File

@@ -8,8 +8,6 @@ package net.i2p.router;
*
*/
import java.util.Comparator;
import net.i2p.util.Log;
/**

View File

@@ -16,8 +16,8 @@ import net.i2p.util.Log;
*
*/
class OutboundMessageState {
private I2PAppContext _context;
private Log _log;
private final I2PAppContext _context;
private final Log _log;
/** may be null if we are part of the establishment */
private OutNetMessage _message;
private long _messageId;
@@ -49,6 +49,7 @@ class OutboundMessageState {
_log = _context.logManager().getLog(OutboundMessageState.class);
}
/****
public boolean initialize(OutNetMessage msg) {
if (msg == null) return false;
try {
@@ -60,7 +61,11 @@ class OutboundMessageState {
return false;
}
}
****/
/**
* Called from UDPTransport
*/
public boolean initialize(I2NPMessage msg, PeerState peer) {
if (msg == null)
return false;
@@ -75,6 +80,9 @@ class OutboundMessageState {
}
}
/**
* Called from OutboundMessageFragments
*/
public boolean initialize(OutNetMessage m, I2NPMessage msg) {
if ( (m == null) || (msg == null) )
return false;

View File

@@ -1581,6 +1581,8 @@ class PeerState {
}
}
// why removed? Some risk of dups in OutboundMessageFragments._activePeers ???
/*
public int hashCode() {
if (_remotePeer != null)

View File

@@ -17,7 +17,7 @@ import net.i2p.util.Log;
* with code to fail messages that expire.
*
* WARNING - UNUSED since 0.6.1.11
* See comments in DQAT.java and mtn history ca. 2006-02-19
* See comments in DummyThrottle.java and mtn history ca. 2006-02-19
*
*/
class TimedWeightedPriorityMessageQueue implements MessageQueue, OutboundMessageFragments.ActiveThrottle {

View File

@@ -184,7 +184,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
_peersByRemoteHost = new ConcurrentHashMap(128);
_dropList = new ConcurrentHashSet(2);
// See comments in DQAT.java
// See comments in DummyThrottle.java
if (USE_PRIORITY) {
TimedWeightedPriorityMessageQueue mq = new TimedWeightedPriorityMessageQueue(ctx, PRIORITY_LIMITS, PRIORITY_WEIGHT, this);
_outboundMessages = mq;
@@ -296,7 +296,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
if (_handler == null)
_handler = new PacketHandler(_context, this, _endpoint, _establisher, _inboundFragments, _testManager, _introManager);
// See comments in DQAT.java
// See comments in DummyThrottle.java
if (USE_PRIORITY && _refiller == null)
_refiller = new OutboundRefiller(_context, _fragments, _outboundMessages);
@@ -1112,6 +1112,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
private static final int MIN_EXPIRE_TIMEOUT = 10*60*1000;
public String getStyle() { return STYLE; }
@Override
public void send(OutNetMessage msg) {
if (msg == null) return;
@@ -1151,7 +1152,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
if (_log.shouldLog(Log.DEBUG))
_log.debug("Add to fragments for " + to.toBase64());
// See comments in DQAT.java
// See comments in DummyThrottle.java
if (USE_PRIORITY)
_outboundMessages.add(msg);
else // skip the priority queue and go straight to the active pool
@@ -1163,6 +1164,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
_establisher.establish(msg);
}
}
void send(I2NPMessage msg, PeerState peer) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Injecting a data message to a new peer: " + peer);