Changeset 12117


Ignore:
Timestamp:
Mar 9, 2011, 3:31:54 PM (11 years ago)
Author:
jch
Message:

Protect against broken implementations of monotonic time.

Fixes #4090.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/third-party/libutp/utp.cpp

    r11984 r12117  
    18941894                int seq = conn->seq_nr - conn->cur_window_packets + i;
    18951895                OutgoingPacket *pkt = (OutgoingPacket*)conn->outbuf.get(seq);
     1896                int64 rtt;
    18961897                if (pkt == 0 || pkt->transmissions == 0) continue;
    18971898                assert((int)(pkt->payload) >= 0);
    18981899                acked_bytes += pkt->payload;
    1899                 min_rtt = min<int64>(min_rtt, UTP_GetMicroseconds() - pkt->time_sent);
     1900                rtt = UTP_GetMicroseconds() - pkt->time_sent;
     1901                if(rtt < 0) {
     1902                        LOG_UTP("UTP_GetMicroseconds decreased (%ld > %ld).  "
     1903                                "This should not happen.",
     1904                                (long)pkt->time_sent,
     1905                                (long)(pkt->time_sent + rtt));
     1906                        rtt = 0;
     1907                }
     1908                min_rtt = min<int64>(min_rtt, rtt);
    19001909        }
    19011910       
Note: See TracChangeset for help on using the changeset viewer.