Streaming: Fix sending messages with expired times (ticket #2451)

This commit is contained in:
zzz
2019-03-01 18:00:54 +00:00
parent d1617dd0b6
commit 82d187438f
3 changed files with 17 additions and 3 deletions

View File

@ -44,6 +44,7 @@ class PacketQueue implements SendMessageStatusListener, Closeable {
private static final int FINAL_TAG_THRESHOLD = 2; private static final int FINAL_TAG_THRESHOLD = 2;
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;
private static final long I2CP_EXPIRATION_ADJUST = Math.min(25, Connection.MIN_RESEND_DELAY / 4);
public PacketQueue(I2PAppContext context, SimpleTimer2 timer) { public PacketQueue(I2PAppContext context, SimpleTimer2 timer) {
_context = context; _context = context;
@ -117,10 +118,15 @@ class PacketQueue implements SendMessageStatusListener, Closeable {
begin = _context.clock().now(); begin = _context.clock().now();
long expires = 0; long expires = 0;
Connection.ResendPacketEvent rpe = (Connection.ResendPacketEvent) packet.getResendEvent(); 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, // we want the router to expire it a little before we do,
// so if we retransmit it will use a new tunnel/lease combo // 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(); SendMessageOptions options = new SendMessageOptions();
if (expires > 0) if (expires > 0)
options.setDate(expires); options.setDate(expires);

View File

@ -1,3 +1,11 @@
2019-03-01 zzz
* Streaming: Fix sending messages with expired times (ticket #2451)
2019-02-28 zzz
* Console:
- Fix router logs not shown if first msg is a dup
- Change fallback client names to use b32
2019-02-26 zzz 2019-02-26 zzz
* SSU: * SSU:
- Fix scheduling of peer test at startup (ticket #2441) - Fix scheduling of peer test at startup (ticket #2441)

View File

@ -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 = 11; public final static long BUILD = 12;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";