If the client connected and then immediately disconnected, or disconnected
before sending enough of a handshake to be classified as good or bad, we
tried to record the usage record as if the connection was complete ("happy"),
which triggered an assertion. This dumps an error to the log and failed to
record the usage record. In May 2020, this happened 55 times in 40 days.
If the file receiver hangs up on an established connection, we do a
`transport.loseConnection()` on the buddy (the file sender). But apparently
it takes a moment (perhaps a roundtrip through the kernel) for the incoming
data to stop, and that used to cause an error. In May 2020 this happened 11
times in 40 days. Now we just ignore this late data.
The default was "tcp:4001", which happens to expand into
"tcp:4001:interface=127.0.0.1", which limits the listening socket to IPv4
connections only.
Changing it to "tcp:4001:interface=\:\:1" means "listen on ::1", which is the
IPv6 name for the loopback interface, and gets us a socket that accepts both
IPv4 and IPv6 connections.
Note: this might cause incompatibilities with IPv4-only hosts, if they don't
accept the "::1" name. For these systems, run the server as `twist
transitrelay --port=tcp:4001" to revert to the old behavior.
closes#12
Maybe windows+py36 was failing because "456" is too small of a value, and the
OS time libraries can't figure out UTC for something back in 1970. Switch to
a fixed timestamp from just a few minutes ago, to see if it likes 2018
better.
For some reason, the appveyor (windows) tests fail on py36 with an OSError
during an internal (twisted.python.log) call to datetime.fromtimestamp().
It's possible that my mock times are too old (I'm using made-up values like
"456"), but maybe it's just that real time.time() returns a float instead of
an integer.
Use rlimit() to allow the server to have more than 1024 simultaneous open
file descriptors. That would limit us to about 510 connections. The new limit
varies depending on the operating system, but is closer to a million.
closes#2
This code was originally in magic-wormhole, embedded in the server startup
code. I carved it out to a separate file (with tests) in mailbox-server, but
it should be used here too.
Clean up usage logging: record events properly. The previous code would
double-count handshake failures (as both "errory" and "lonely"). Rewrite the
munin plugins to be more general.