We still tell the remote host about the observed addr but we don't store it.
That way, we give them a chance to decide if they want to actually use and
advertise it.
Ideally, we'd distinguish between local information and signed routing
information but we don't do that yet.
This should reduce the address explosion issue where peers learn about
multiple (bad) observed addresses for the same peer. It should also give peers
more control over how they can be dialed.
Sending a protocol version is nice. However, this "disconnect if our versions
are different" logic makes the version entirely useless (because we can't change
it).
Really, each indevidual protocol is versioned so let's just leave it at that. If
we make a breaking change that requires a protocol bump, we can do that and
then switch on the other side's version. However, we'll have to wait for the
entire network to upgrade for that to work.
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 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.
There were previously 4 different ways of passing various options
into BasicHost construction.
1. Function parameters to New
2. Option parameters to New
3. Global variables, e.g. NegotiateTimeout
4. Options struct, in the calling code in go-ipfs
This changeset deprecated all of these, and introduces the HostOpts
struct to replace them. It also introduces a new constructor called
NewHost, which accepts a *HostOpts.
The old New constructor continues to work the same way,
but is from now on deprecated too.