Changeset 82d1874 for apps


Ignore:
Timestamp:
Mar 1, 2019 6:00:54 PM (15 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
f0b9986e
Parents:
d1617dd
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/streaming/java/src/net/i2p/client/streaming/impl/PacketQueue.java

    rd1617dd r82d1874  
    4545    private static final long REMOVE_EXPIRED_TIME = 67*1000;
    4646    private static final boolean ENABLE_STATUS_LISTEN = true;
     47    private static final long I2CP_EXPIRATION_ADJUST = Math.min(25, Connection.MIN_RESEND_DELAY / 4);
    4748
    4849    public PacketQueue(I2PAppContext context, SimpleTimer2 timer) {
     
    118119            long expires = 0;
    119120            Connection.ResendPacketEvent rpe = (Connection.ResendPacketEvent) packet.getResendEvent();
    120             if (rpe != null)
     121            if (rpe != null) {
    121122                // we want the router to expire it a little before we do,
    122123                // so if we retransmit it will use a new tunnel/lease combo
    123                 expires = rpe.getNextSendTime() - 500;
     124                // If we are really close to the timeout already,
     125                // give this packet a chance to be sent,
     126                // but it's likely to be dropped on the router side if we're
     127                // running this far behind.
     128                expires = Math.max(rpe.getNextSendTime() - I2CP_EXPIRATION_ADJUST, begin + 25);
     129            }
    124130            SendMessageOptions options = new SendMessageOptions();
    125131            if (expires > 0)
Note: See TracChangeset for help on using the changeset viewer.