- changed GetStreams function from mock_conn.go to call allStreams which has the same functionality but is concurrent safe
- changed protocol field from mock_stream to be concurrent safe. Taken the implementation from swarm_stream.go
Technically a breaking change because I changed the constructor casing but
nobody's using this outside of libp2p (yet), mostly because the type hasn't been
exported.
RandLocalTCPAddress is mostly useful when we *actually* want to listen on a real
address. Unfortunately, when running a bunch of tests, we can actually run
out.
With this change, a collision means we have a duplicate peer ID so yeah...
fixes#473
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.
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.