Update send/ack timers on empty diff

The root problem here is that writes to the frame buffer may alter it,
but leave it with the same contents as before, and the diff between
the two states is the empty string.  With the dirty-rows,
smart-pointer changes to Framebuffer, it is easy to run into this
situation.  This got Network::TransportSender confused about timeouts,
and mosh-server would spin.

The theoretically correct fix would be to have operator==() exactly
correspond to diff(otherstate).empty().  I have partly implemented
this (and may yet finish) but it's not trivial to get right.

This is a much simpler fix that simply attempts to correctly update
timers when two framebuffers are different and an empty diff is
generated.
This commit is contained in:
John Hood
2016-10-28 01:59:24 -04:00
parent 9ffbeddbc8
commit 3e414c46b3
+10 -5
View File
@@ -187,11 +187,16 @@ void TransportSender<MyState>::tick( void )
}
}
if ( diff.empty() && (now >= next_ack_time) ) {
send_empty_ack();
mindelay_clock = uint64_t( -1 );
} else if ( !diff.empty() && ( (now >= next_send_time)
|| (now >= next_ack_time) ) ) {
if ( diff.empty() ) {
if ( (now >= next_ack_time) ) {
send_empty_ack();
mindelay_clock = uint64_t( -1 );
}
if ( (now >= next_send_time) ) {
next_send_time = uint64_t( -1 );
mindelay_clock = uint64_t( -1 );
}
} else if ( (now >= next_send_time) || (now >= next_ack_time) ) {
/* Send diffs or ack */
send_to_receiver( diff );
mindelay_clock = uint64_t( -1 );