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.
Some systems do not deliver SIGPIPE to shell pipeline writers when the
downstream reader has exited. So, also check for errors from
/bin/printf. I fixed this for OpenBSD 6.0 but I think it will also
fix posh on Linux.
Replace some blind timeouts with actual synchronization.
Improve performance on some slow tests.
Tweak some of the remaining timeouts.
This still isn't good enough to get 'make -j9 check'
working reliably on Cygwin for me; I think some Cygwin/
Windows scheduling issues remain.
This eliminates issues with typeahead being echoed by the remote pty
and corrupting remote output from mosh-server to the mosh script, but
cannot be made default because older mosh-servers require a pty.
Also cleans up other setsockopt() calls, and buffer sizing/handling
for recvmsg().
These are minor errors and no actual misbehavior was observed.
Discovered while working Windows Subsystem for Linux compatibility
issues.
Improves 679b819216 to make it simpler to
ignore mosh-client from OS X Terminal.app's "Ask before closing" process
list. (See: http://superuser.com/a/254647)
Moreover, the command displayed from ps is a completely functional one,
which was not the case in the previous approach, that mangles `argv[0]`.
Fixes#742.