diff --git a/contrib/interconnect/udp/ic_udpifc.c b/contrib/interconnect/udp/ic_udpifc.c index 0f23ecaad8e..77f3772eab6 100644 --- a/contrib/interconnect/udp/ic_udpifc.c +++ b/contrib/interconnect/udp/ic_udpifc.c @@ -7027,8 +7027,14 @@ putIntoUnackQueueRing(UnackQueueRing *uqr, ICBuffer *buf, uint64 expTime, uint64 } else if (diff < TIMER_SPAN_LOSS) { - diff = diff < TIMER_SPAN_LOSS ? TIMER_SPAN_LOSS : diff; + diff = TIMER_SPAN_LOSS; } + + idx = (uqr->idx + diff / TIMER_SPAN_LOSS) % UNACK_QUEUE_RING_SLOTS_NUM; + +#ifdef AMS_VERBOSE_LOGGING + write_log("PUTTW: curtime " UINT64_FORMAT " now " UINT64_FORMAT " (diff " UINT64_FORMAT ") expTime " UINT64_FORMAT " previdx %d, nowidx %d, nextidx %d", uqr->currentTime, now, diff, expTime, buf->unackQueueRingSlot, uqr->idx, idx); +#endif } else { @@ -7055,12 +7061,6 @@ putIntoUnackQueueRing(UnackQueueRing *uqr, ICBuffer *buf, uint64 expTime, uint64 #endif } - idx = (uqr->idx + diff / TIMER_SPAN) % UNACK_QUEUE_RING_SLOTS_NUM; - -#ifdef AMS_VERBOSE_LOGGING - write_log("PUTTW: curtime " UINT64_FORMAT " now " UINT64_FORMAT " (diff " UINT64_FORMAT ") expTime " UINT64_FORMAT " previdx %d, nowidx %d, nextidx %d", uqr->currentTime, now, diff, expTime, buf->unackQueueRingSlot, uqr->idx, idx); -#endif - buf->unackQueueRingSlot = idx; icBufferListAppend(&unack_queue_ring.slots[idx], buf); } diff --git a/contrib/udp2/ic_common/udp2/ic_udp2.cpp b/contrib/udp2/ic_common/udp2/ic_udp2.cpp index ca001646151..f56e0198b46 100644 --- a/contrib/udp2/ic_common/udp2/ic_udp2.cpp +++ b/contrib/udp2/ic_common/udp2/ic_udp2.cpp @@ -3049,8 +3049,14 @@ putIntoUnackQueueRing(UnackQueueRing *uqr, ICBuffer *buf, uint64 expTime, uint64 } else if (diff < TIMER_SPAN_LOSS) { - diff = diff < TIMER_SPAN_LOSS ? TIMER_SPAN_LOSS : diff; + diff = TIMER_SPAN_LOSS; } + + idx = (uqr->idx + diff / TIMER_SPAN_LOSS) % UNACK_QUEUE_RING_SLOTS_NUM; + +#ifdef AMS_VERBOSE_LOGGING + LOG(INFO, "PUTTW: curtime %lu now %lu (diff %lu) expTime %lu previdx %d, nowidx %d, nextidx %d", uqr->currentTime, now, diff, expTime, buf->unackQueueRingSlot, uqr->idx, idx); +#endif } else { @@ -3077,12 +3083,6 @@ putIntoUnackQueueRing(UnackQueueRing *uqr, ICBuffer *buf, uint64 expTime, uint64 #endif } - idx = (uqr->idx + diff / TIMER_SPAN) % UNACK_QUEUE_RING_SLOTS_NUM; - -#ifdef AMS_VERBOSE_LOGGING - LOG(INFO, "PUTTW: curtime %lu now %lu (diff %lu) expTime %lu previdx %d, nowidx %d, nextidx %d", uqr->currentTime, now, diff, expTime, buf->unackQueueRingSlot, uqr->idx, idx); -#endif - buf->unackQueueRingSlot = idx; unack_queue_ring.slots[idx].append(buf); }