Skip to content

Commit aa2068e

Browse files
tcp: Avoid timestamp being nullptr when measuring
1 parent 807b424 commit aa2068e

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/net/tcp/connection.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,9 +629,14 @@ void Connection::take_rtt_measure(const Packet& packet)
629629
if(cb.SND.TS_OK)
630630
{
631631
auto* ts = parse_ts_option(packet);
632-
rttm.rtt_measurement(RTTM::milliseconds{host_.get_ts_value() - ntohl(ts->ecr)});
632+
if(ts)
633+
{
634+
rttm.rtt_measurement(RTTM::milliseconds{host_.get_ts_value() - ntohl(ts->ecr)});
635+
return;
636+
}
633637
}
634-
else if(rttm.active())
638+
639+
if(rttm.active())
635640
{
636641
rttm.stop(RTTM::milliseconds{host_.get_ts_value()});
637642
}

0 commit comments

Comments
 (0)