Explicit echo ack protobuf with reliable semantics

This commit is contained in:
Keith Winstein
2012-02-25 14:34:39 -05:00
parent e9ce05bc7b
commit 3a92cd1393
13 changed files with 72 additions and 51 deletions
+9 -1
View File
@@ -251,12 +251,16 @@ void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &network
break;
}
uint64_t now = Network::timestamp();
if ( pollfds[ 0 ].revents & POLLIN ) {
/* packet received from the network */
network.recv();
/* is new user input available for the terminal? */
if ( network.get_remote_state_num() != last_remote_num ) {
last_remote_num = network.get_remote_state_num();
string terminal_to_host;
Network::UserStream us;
@@ -277,6 +281,9 @@ void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &network
}
}
/* register input frame number for future echo ack */
terminal.register_input_frame( last_remote_num, now );
/* update client with new state of terminal */
if ( !network.shutdown_in_progress() ) {
network.set_current_state( terminal );
@@ -381,7 +388,7 @@ void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &network
/* update utmp if has been more than 10 seconds since heard from client */
if ( connected_utmp ) {
if ( network.get_latest_remote_state().timestamp < Network::timestamp() - 10000 ) {
if ( network.get_latest_remote_state().timestamp < now - 10000 ) {
utempter_remove_added_record();
char tmp[ 64 ];
@@ -392,6 +399,7 @@ void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &network
}
}
terminal.set_echo_ack( now );
network.tick();
} catch ( Network::NetworkException e ) {
fprintf( stderr, "%s: %s\n", e.function.c_str(), strerror( e.the_errno ) );
+1 -1
View File
@@ -182,7 +182,7 @@ bool STMClient::process_network_input( void )
overlays.get_prediction_engine().set_local_frame_acked( network->get_sent_state_acked() );
overlays.get_prediction_engine().set_send_interval( network->send_interval() );
overlays.get_prediction_engine().set_local_frame_late_acked( network->get_sent_state_late_acked() );
overlays.get_prediction_engine().set_local_frame_late_acked( network->get_latest_remote_state().state.get_echo_ack() );
return true;
}