Choose server-side echo ack more carefully
This commit is contained in:
+10
-5
@@ -287,10 +287,15 @@ void TransportSender<MyState>::set_ack_num( uint64_t s_ack_num )
|
|||||||
template <class MyState>
|
template <class MyState>
|
||||||
uint64_t TransportSender<MyState>::get_late_ack( uint64_t now )
|
uint64_t TransportSender<MyState>::get_late_ack( uint64_t now )
|
||||||
{
|
{
|
||||||
ack_history.remove_if( [&]( const pair<uint64_t, uint64_t> &x ) { return x.second < now - ECHO_TIMEOUT; } );
|
uint64_t newest_echo_ack = 0;
|
||||||
if ( !ack_history.empty() ) {
|
|
||||||
return ack_history.front().first - 1;
|
for ( auto i = ack_history.begin(); i != ack_history.end(); i++ ) {
|
||||||
} else { /* every ack has gone past the echo timeout */
|
if ( i->second < now - ECHO_TIMEOUT ) {
|
||||||
return ack_num;
|
newest_echo_ack = i->first;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ack_history.remove_if( [&]( const pair<uint64_t, uint64_t> &x ) { return x.first < newest_echo_ack; } );
|
||||||
|
|
||||||
|
return newest_echo_ack;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user