Prevent endless cascade of RTT acks

This commit is contained in:
Keith Winstein
2011-08-10 02:17:04 -04:00
parent b2ea532f14
commit 3d5942b3d4
3 changed files with 11 additions and 5 deletions
+9 -3
View File
@@ -148,11 +148,17 @@ void Connection::update_MTU( void )
fprintf( stderr, "Path MTU: %d\n", MTU );
}
void Connection::send( string &s )
void Connection::send( string &s, bool send_timestamp )
{
assert( attached );
string p = new_packet( s ).tostring( &session );
Packet px = new_packet( s );
if ( !send_timestamp ) {
px.timestamp = -1;
}
string p = px.tostring( &session );
/* XXX synthetic packet loss */
if ( rand() < RAND_MAX / 2 ) {
@@ -258,7 +264,7 @@ uint64_t Network::timestamp( void )
}
uint64_t millis = tp.tv_nsec / 1000000;
millis += uint64_t( tp.tv_sec ) * 1000000;
millis += uint64_t( tp.tv_sec ) * 1000;
return millis;
}
+1 -1
View File
@@ -85,7 +85,7 @@ namespace Network {
Connection();
Connection( const char *key_str, const char *ip, int port );
void send( string &s );
void send( string &s, bool send_timestamp = true );
string recv( void );
int fd( void ) { return sock; }
int get_MTU( void ) { return MTU; }
+1 -1
View File
@@ -89,7 +89,7 @@ void Transport<MyState, RemoteState>::send_to_receiver( void )
sent_states.front().num,
"" );
string s = inst.tostring();
connection.send( s );
connection.send( s, false );
assumed_receiver_state->timestamp = timestamp();
return;