Don't do prediction on large pastes into mosh-client.

Fixes #482, memory use blowup on large pastes.  mosh is still pretty slow
about copying pastes through, though.
This commit is contained in:
John Hood
2017-05-06 23:28:29 -04:00
parent 48e9dd169f
commit 91de8901f5
+9 -1
View File
@@ -318,10 +318,18 @@ bool STMClient::process_user_input( int fd )
if ( !network->shutdown_in_progress() ) {
overlays.get_prediction_engine().set_local_frame_sent( network->get_sent_state_last() );
/* Don't predict for bulk data. */
bool paste = bytes_read > 100;
if ( paste ) {
overlays.get_prediction_engine().reset();
}
for ( int i = 0; i < bytes_read; i++ ) {
char the_byte = buf[ i ];
overlays.get_prediction_engine().new_user_byte( the_byte, local_framebuffer );
if ( !paste ) {
overlays.get_prediction_engine().new_user_byte( the_byte, local_framebuffer );
}
if ( quit_sequence_started ) {
if ( the_byte == '.' ) { /* Quit sequence is Ctrl-^ . */