forked from I2P_Developers/i2p.i2p
Streaming: Fix sending messages with expired times (ticket #2451)
This commit is contained in:
@ -44,6 +44,7 @@ class PacketQueue implements SendMessageStatusListener, Closeable {
|
||||
private static final int FINAL_TAG_THRESHOLD = 2;
|
||||
private static final long REMOVE_EXPIRED_TIME = 67*1000;
|
||||
private static final boolean ENABLE_STATUS_LISTEN = true;
|
||||
private static final long I2CP_EXPIRATION_ADJUST = Math.min(25, Connection.MIN_RESEND_DELAY / 4);
|
||||
|
||||
public PacketQueue(I2PAppContext context, SimpleTimer2 timer) {
|
||||
_context = context;
|
||||
@ -117,10 +118,15 @@ class PacketQueue implements SendMessageStatusListener, Closeable {
|
||||
begin = _context.clock().now();
|
||||
long expires = 0;
|
||||
Connection.ResendPacketEvent rpe = (Connection.ResendPacketEvent) packet.getResendEvent();
|
||||
if (rpe != null)
|
||||
if (rpe != null) {
|
||||
// we want the router to expire it a little before we do,
|
||||
// so if we retransmit it will use a new tunnel/lease combo
|
||||
expires = rpe.getNextSendTime() - 500;
|
||||
// If we are really close to the timeout already,
|
||||
// give this packet a chance to be sent,
|
||||
// but it's likely to be dropped on the router side if we're
|
||||
// running this far behind.
|
||||
expires = Math.max(rpe.getNextSendTime() - I2CP_EXPIRATION_ADJUST, begin + 25);
|
||||
}
|
||||
SendMessageOptions options = new SendMessageOptions();
|
||||
if (expires > 0)
|
||||
options.setDate(expires);
|
||||
|
Reference in New Issue
Block a user