aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Peter Edwards <peadar@arista.com>2019-01-04 03:57:59 -0800
committerGravatar Peter Edwards <peadar@arista.com>2019-01-04 04:06:30 -0800
commitc3a2756065a0fb04cfd2681280123b362d862a5e (patch)
tree0abc43640515d215a99f3dacf96e0a85716cfd1a /src
parent944fd6c796338235c4f3d8daf4959ff658f12760 (diff)
Apply latest consecutive resize, not earliest.
If there are consecutive resize events in the userstream to be applied in "serve", we should apply the last/latest one in the sequence, not the first/earliest one. This fixes a problem where a flurry of resize events (eg, generated by a window manager resizing the client), can cause mosh to have an out-of-date idea as to what the physical geometry of the window is.
Diffstat (limited to 'src')
-rw-r--r--src/frontend/mosh-server.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/frontend/mosh-server.cc b/src/frontend/mosh-server.cc
index 21057e8..4aa6d5f 100644
--- a/src/frontend/mosh-server.cc
+++ b/src/frontend/mosh-server.cc
@@ -739,12 +739,11 @@ static void serve( int host_fd, Terminal::Complete &terminal, ServerConnection &
const Parser::Action &action = us.get_action( i );
if ( typeid( action ) == typeid( Parser::Resize ) ) {
/* apply only the last consecutive Resize action */
- while ( i < us.size() - 1 ) {
- const Parser::Action &next = us.get_action( i + 1 );
- if ( typeid( next ) != typeid( Parser::Resize ) ) {
- break;
+ if ( i < us.size() - 1 ) {
+ const Parser::Action &next = us.get_action( i + 1 );
+ if ( typeid( next ) == typeid( Parser::Resize ) ) {
+ continue;
}
- i++;
}
/* tell child process of resize */
const Parser::Resize &res = static_cast<const Parser::Resize &>( action );