From 1e003b0e76f8372243f2886a9fb2bf7dbc45016a Mon Sep 17 00:00:00 2001 From: John Hood Date: Sat, 24 Oct 2015 16:23:17 -0400 Subject: [PATCH] mosh-server: skip redundant resize requests This might reduce redraw activity on window resize, especially for slow servers. --- src/frontend/mosh-server.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/frontend/mosh-server.cc b/src/frontend/mosh-server.cc index 8d7163b..5a1dbeb 100644 --- a/src/frontend/mosh-server.cc +++ b/src/frontend/mosh-server.cc @@ -656,8 +656,13 @@ static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection & const Parser::Action *action = us.get_action( i ); terminal_to_host += terminal.act( action ); if ( typeid( *action ) == typeid( Parser::Resize ) ) { + /* elide consecutive Resize actions */ + if ( i < us.size() - 1 && + typeid( us.get_action( i + 1 ) ) == typeid( Parser::Resize ) ) { + continue; + } /* tell child process of resize */ - const Parser::Resize *res = static_cast( us.get_action( i ) ); + const Parser::Resize *res = static_cast( action ); struct winsize window_size; if ( ioctl( host_fd, TIOCGWINSZ, &window_size ) < 0 ) { perror( "ioctl TIOCGWINSZ" );