Prevent endless cascade of RTT acks
This commit is contained in:
+9
-3
@@ -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
@@ -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; }
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user