forked from I2P_Developers/i2p.i2p
remove session ref from PacketQueue
This commit is contained in:
@ -88,7 +88,7 @@ class ConnectionManager {
|
|||||||
// As of 0.9.1, listen on configured port (default 0 = all)
|
// As of 0.9.1, listen on configured port (default 0 = all)
|
||||||
int protocol = defaultOptions.getEnforceProtocol() ? I2PSession.PROTO_STREAMING : I2PSession.PROTO_ANY;
|
int protocol = defaultOptions.getEnforceProtocol() ? I2PSession.PROTO_STREAMING : I2PSession.PROTO_ANY;
|
||||||
_session.addMuxedSessionListener(_messageHandler, protocol, defaultOptions.getLocalPort());
|
_session.addMuxedSessionListener(_messageHandler, protocol, defaultOptions.getLocalPort());
|
||||||
_outboundQueue = new PacketQueue(_context, _session);
|
_outboundQueue = new PacketQueue(_context);
|
||||||
_recentlyClosed = new LHMCache<Long, Object>(32);
|
_recentlyClosed = new LHMCache<Long, Object>(32);
|
||||||
/** Socket timeout for accept() */
|
/** Socket timeout for accept() */
|
||||||
_soTimeout = -1;
|
_soTimeout = -1;
|
||||||
@ -893,7 +893,7 @@ class ConnectionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @since 0.9.20
|
* @since 0.9.21
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -28,7 +28,6 @@ import net.i2p.util.SimpleTimer2;
|
|||||||
class PacketQueue implements SendMessageStatusListener {
|
class PacketQueue implements SendMessageStatusListener {
|
||||||
private final I2PAppContext _context;
|
private final I2PAppContext _context;
|
||||||
private final Log _log;
|
private final Log _log;
|
||||||
private final I2PSession _session;
|
|
||||||
private final ByteCache _cache = ByteCache.getInstance(64, 36*1024);
|
private final ByteCache _cache = ByteCache.getInstance(64, 36*1024);
|
||||||
private final Map<Long, Connection> _messageStatusMap;
|
private final Map<Long, Connection> _messageStatusMap;
|
||||||
private volatile boolean _dead;
|
private volatile boolean _dead;
|
||||||
@ -45,9 +44,8 @@ class PacketQueue implements SendMessageStatusListener {
|
|||||||
private static final long REMOVE_EXPIRED_TIME = 67*1000;
|
private static final long REMOVE_EXPIRED_TIME = 67*1000;
|
||||||
private static final boolean ENABLE_STATUS_LISTEN = true;
|
private static final boolean ENABLE_STATUS_LISTEN = true;
|
||||||
|
|
||||||
public PacketQueue(I2PAppContext context, I2PSession session) {
|
public PacketQueue(I2PAppContext context) {
|
||||||
_context = context;
|
_context = context;
|
||||||
_session = session;
|
|
||||||
_log = context.logManager().getLog(PacketQueue.class);
|
_log = context.logManager().getLog(PacketQueue.class);
|
||||||
_messageStatusMap = new ConcurrentHashMap<Long, Connection>(16);
|
_messageStatusMap = new ConcurrentHashMap<Long, Connection>(16);
|
||||||
new RemoveExpired();
|
new RemoveExpired();
|
||||||
@ -153,14 +151,15 @@ class PacketQueue implements SendMessageStatusListener {
|
|||||||
options.setTagThreshold(thresh);
|
options.setTagThreshold(thresh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
I2PSession session = packet.getSession();
|
||||||
if (listenForStatus) {
|
if (listenForStatus) {
|
||||||
long id = _session.sendMessage(packet.getTo(), buf, 0, size,
|
long id = session.sendMessage(packet.getTo(), buf, 0, size,
|
||||||
I2PSession.PROTO_STREAMING, packet.getLocalPort(), packet.getRemotePort(),
|
I2PSession.PROTO_STREAMING, packet.getLocalPort(), packet.getRemotePort(),
|
||||||
options, this);
|
options, this);
|
||||||
_messageStatusMap.put(Long.valueOf(id), packet.getConnection());
|
_messageStatusMap.put(Long.valueOf(id), packet.getConnection());
|
||||||
sent = true;
|
sent = true;
|
||||||
} else {
|
} else {
|
||||||
sent = _session.sendMessage(packet.getTo(), buf, 0, size,
|
sent = session.sendMessage(packet.getTo(), buf, 0, size,
|
||||||
I2PSession.PROTO_STREAMING, packet.getLocalPort(), packet.getRemotePort(),
|
I2PSession.PROTO_STREAMING, packet.getLocalPort(), packet.getRemotePort(),
|
||||||
options);
|
options);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user