fixes#419
Also call FullClose in a goroutine; no need to block this.
(not happy with that but I'm starting to think we need to rethink stream
closing, again...)
This reverts commit aca83b9b63, reversing
changes made to 86b8929d4d.
This was is not the correct fix. We already expose these addresses via the
host's AllAddrs method. The real problem is probably that we just don't ever
tell anyone about them (unless we disconnect and reconnect to our nearby DHT
nodes).
We need an address gossip protocol.
This happens all the time in tests where we intentionally use fake keys for
performance.
Anyways, users probably don't want their logs spammed with errors they can't do
anything about.
This commit prevents us from repeatedly extending the lifetimes of all observed
addresses if a peer keeps on reconnecting.
It also fixes two race conditions:
1. We may end up processing a disconnect after a re-connect and may
accidentally give the addresses associated with that peer a
RecentlyConnectedAddrTTL instead of a ConnectedAddrTTL.
2. We may end up processing a connect after the associated disconnect storing
the associated peer addresses indefinitely.
Before, on close, we:
1. Weren't completing the write.
2. Flushing the buffer without waiting the latency delay.
This fixes that by using two separate channels for close/reset and ignoring the
close channel in deliverOrWait.
* Fix the tests to work with separate reset/close methods.
* Ensure we interrupt writes on reset.
* Always delay the proper time even if we're sending short messages.
* Copy buffers as we send them. `Write` is not allowed to hang onto buffers. If
we run into performance issues, we can always add a buffer pool.