On some Linux systems this is the default. On most other operating
systems accepting IPv4 connections on a IPv6 socket only happens when
explicitly requested. Even on Linux it depends on the sysctl config.
This change makes it independent from the system's defaults whether IPv4
connections will be accepted too through the same socket.
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.
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.
Add another round-trip verification. For both original and generated
state, generate a diff from an initial, empty state. Verify that
these two diffs are the same.
The problem was that the round-trip verification code copies the
current state, which may contain intermediate Parser state for
multibyte characters and ANSI escape sequences. It then applies diffs
to that copy, which may appear as badly formed input.
Also removes some dead, never-used code.
This refactors out a very common pattern of formatting "%s: %s" with
e.function.c_str() and strerror( e.the_errno ) into just the what()
method of NetworkException. It's also a prerequisite for making cleaner
public API for any exceptions we throw, and allows us to more easily
get exceptions passed back to us to handle.
This reverts commit 578db45fbf.
The NULL inputs to getaddrinfo are valid in certain cases, and at
least in the case of node, important. The segfault happens not with
getaddrinfo, but with the error message generation below it.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>