Use end-to-end-to-end connectivity (in transport layer) to control port hop.

Avoid playing games with network-layer timestamps.
This commit is contained in:
Keith Winstein
2012-08-13 16:48:25 +03:00
parent a21fed3dca
commit 5376ed1996
3 changed files with 41 additions and 9 deletions
+10 -1
View File
@@ -91,6 +91,9 @@ namespace Network {
static const int PORT_RANGE_LOW = 60001;
static const int PORT_RANGE_HIGH = 60999;
static const unsigned int SERVER_ASSOCIATION_TIMEOUT = 20000;
static const unsigned int PORT_HOP_INTERVAL = 20000;
static bool try_bind( int socket, uint32_t addr, int port );
int sock;
@@ -112,6 +115,10 @@ namespace Network {
uint64_t saved_timestamp_received_at;
uint64_t expected_receiver_seq;
uint64_t last_heard;
uint64_t last_port_choice;
uint64_t last_roundtrip_success; /* transport layer needs to tell us this */
bool RTT_hit;
double SRTT;
double RTTVAR;
@@ -123,6 +130,8 @@ namespace Network {
Packet new_packet( string &s_payload );
void hop_port( void );
public:
Connection( const char *desired_ip, const char *desired_port ); /* server */
Connection( const char *key_str, const char *ip, int port ); /* client */
@@ -147,7 +156,7 @@ namespace Network {
return have_send_exception ? &send_exception : NULL;
}
void reset( void );
void set_last_roundtrip_success( uint64_t s_success ) { last_roundtrip_success = s_success; }
};
}