onion-tunnel: don't close listening sockets immediately
- This fixes connections randomly dying sometimes: turns out this
happened if you lost a race condition ("Arti trying to establish a Tor
stream" versus "the smoltcp event loop completing the 3-way
handshake").
- This happens because the implementations of
AsyncRead
andAsyncWrite
for the smoltcp sockets exit ifs.may_recv()
bzw.s.may_send()
returnfalse
, which is true for sockets that aren't yet established.
- This happens because the implementations of
- To alleviate this problem, we count the
LISTEN
andSYN_RECEIVED
TCP state machine states as states where we might be able to receive or send on the socket.
Closes #29 (closed).