Save calculated time since latest remote state

This avoids duplicating a long expression in a future commit.
This commit is contained in:
Keegan McAllister
2012-03-06 02:02:08 -08:00
parent 12fcf6800a
commit 69b7c5cf44
+2 -1
View File
@@ -254,6 +254,7 @@ void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &network
} }
now = Network::timestamp(); now = Network::timestamp();
uint64_t time_since_remote_state = now - network.get_latest_remote_state().timestamp;
if ( pollfds[ 0 ].revents & POLLIN ) { if ( pollfds[ 0 ].revents & POLLIN ) {
/* packet received from the network */ /* packet received from the network */
@@ -392,7 +393,7 @@ void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &network
/* update utmp if has been more than 10 seconds since heard from client */ /* update utmp if has been more than 10 seconds since heard from client */
if ( connected_utmp ) { if ( connected_utmp ) {
if ( network.get_latest_remote_state().timestamp < now - 10000 ) { if ( time_since_remote_state > 10000 ) {
utempter_remove_added_record(); utempter_remove_added_record();
char tmp[ 64 ]; char tmp[ 64 ];