Commit 55e2215a authored by Pavel Doležal's avatar Pavel Doležal
Browse files

Merge branch 'tcp_rtt_fix' into 'devel'

Fix calculation of TCP RTT

See merge request !7
parents eedd6beb a9428258
Pipeline #73766 passed with stage
in 2 minutes and 55 seconds
......@@ -167,6 +167,7 @@ bool DDP::DnsTcpConnection::update_connection(DnsRecord& record, const Packet& p
// Received FIN to close connection
if (header->fin) {
m_rtt = m_state == TcpConnectionState::ESTABLISHED ? m_rtt : Time(Time::Clock::MONOTONIC) - m_rtt;
m_state = TcpConnectionState::FIN1;
m_fin[conn_side] = true;
}
......
......@@ -148,7 +148,7 @@ namespace DDP {
friend Time operator-(Time first, const Time& second)
{
if(first.m_timespec.tv_nsec - second.m_timespec.tv_nsec < 0) {
first.m_timespec.tv_sec -= second.m_timespec.tv_sec - 1;
first.m_timespec.tv_sec = first.m_timespec.tv_sec - second.m_timespec.tv_sec - 1;
first.m_timespec.tv_nsec = first.m_timespec.tv_nsec + 1000000000 - second.m_timespec.tv_nsec;
}
else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment