Deref a shared pointer in a per-byte loop

This commit is contained in:
John Hood
2017-05-13 19:48:55 -04:00
parent 8f68400c13
commit c6c7f09954
+10 -8
View File
@@ -314,8 +314,10 @@ bool STMClient::process_user_input( int fd )
return false; return false;
} }
if ( !network->shutdown_in_progress() ) { NetworkType &net = *network;
overlays.get_prediction_engine().set_local_frame_sent( network->get_sent_state_last() );
if ( !net.shutdown_in_progress() ) {
overlays.get_prediction_engine().set_local_frame_sent( net.get_sent_state_last() );
/* Don't predict for bulk data. */ /* Don't predict for bulk data. */
bool paste = bytes_read > 100; bool paste = bytes_read > 100;
@@ -332,9 +334,9 @@ bool STMClient::process_user_input( int fd )
if ( quit_sequence_started ) { if ( quit_sequence_started ) {
if ( the_byte == '.' ) { /* Quit sequence is Ctrl-^ . */ if ( the_byte == '.' ) { /* Quit sequence is Ctrl-^ . */
if ( network->has_remote_addr() && (!network->shutdown_in_progress()) ) { if ( net.has_remote_addr() && (!net.shutdown_in_progress()) ) {
overlays.get_notification_engine().set_notification_string( wstring( L"Exiting on user request..." ), true ); overlays.get_notification_engine().set_notification_string( wstring( L"Exiting on user request..." ), true );
network->start_shutdown(); net.start_shutdown();
return true; return true;
} else { } else {
return false; return false;
@@ -359,11 +361,11 @@ bool STMClient::process_user_input( int fd )
} else if ( (the_byte == escape_pass_key) || (the_byte == escape_pass_key2) ) { } else if ( (the_byte == escape_pass_key) || (the_byte == escape_pass_key2) ) {
/* Emulation sequence to type escape_key is escape_key + /* Emulation sequence to type escape_key is escape_key +
escape_pass_key (that is escape key without Ctrl) */ escape_pass_key (that is escape key without Ctrl) */
network->get_current_state().push_back( Parser::UserByte( escape_key ) ); net.get_current_state().push_back( Parser::UserByte( escape_key ) );
} else { } else {
/* Escape key followed by anything other than . and ^ gets sent literally */ /* Escape key followed by anything other than . and ^ gets sent literally */
network->get_current_state().push_back( Parser::UserByte( escape_key ) ); net.get_current_state().push_back( Parser::UserByte( escape_key ) );
network->get_current_state().push_back( Parser::UserByte( the_byte ) ); net.get_current_state().push_back( Parser::UserByte( the_byte ) );
} }
quit_sequence_started = false; quit_sequence_started = false;
@@ -388,7 +390,7 @@ bool STMClient::process_user_input( int fd )
repaint_requested = true; repaint_requested = true;
} }
network->get_current_state().push_back( Parser::UserByte( the_byte ) ); net.get_current_state().push_back( Parser::UserByte( the_byte ) );
} }
} }