Add shutdown functionality to `NodeStream`.
Add `NodeStream::shutdown` to allow triggering the shutdown process,
and `NodeStream::poll_shutdown` as the internal way to drive any
potential shutdown to completion.
Update the `StreamMuxer` trait.
- `read_substream`, `write_substream` and `flush_substream` now return `Poll` instead of `Result`.
- A new `Shutdown` enum allows for half-closing of substreams and is used in `shutdown_substream`.
- `close_inbound` and `close_outbound` have been merged into `shutdown` which takes a `Shutdown` parameter to allow closing only one direction.
- Add a new `flush_all` method to allow flushing after a series of actions (e.g. multiple `shutdown_substream`).
W.r.t. flushing the general idea is that normal use drains buffers over time. Shutting down a substream does not imply flushing, so can be followed by `flush_substream` or (if multiple substreams are to be shut down) a single `flush_all`. Shutting down the muxer itself proceeds likewise, i.e. `shutdown` followed by `flush_all`.
* Add unit tests for core::nodes::NodeStream
* Move DummyMuxer to core/tests
* Address grumbles
* Impl Debug for SubstreamRef<P>
* Add test for poll()
* Don't need to open a substream
* pretty printer test
* More tests for NodeStream poll()
* ListenerStream unit tests: transport() and listeners()
* Tests for nodes/listeners.rs
* Add a few tests to help illustrate the "drowning" behaviour of busy listeners
* Address grumbles
* Remove non-project specific stuff
* Address grumbles
* Prefer freestanding function
* Add unit tests for core::nodes::NodeStream
* Move DummyMuxer to core/tests
* Address grumbles
* Impl Debug for SubstreamRef<P>
* Add test for poll()
* Don't need to open a substream
* pretty printer test
* More tests for NodeStream poll()
* Remove contentious test of Debug
* Provide poll() as a regular method when we can't fail
* Add a CollectionReachEvent that allows accepting
* Add small TODO in handled_node
* Implement Debug on collection events
* Implement Debug for CollectionStream
* Implement Debug for structs in handled_node_tasks
* Attempt to fix compilation errors with stable Rust
* Prove the unwrap
Refactor multiaddr crate.
- Remove `AddrComponent`. Instead `Protocol` directly contains its
associated data.
- Various smaller changes around conversions to Multiaddr from other
types, e.g. socket addresses.
- Expand tests to include property tests which test encoding/decoding
identity.
* Rewrite the swarm
* Small improvement to Debug of ListenersStream
* Fix Swarm::Replaced never being produced
* Fix logic problem when reaching a node in swarm
* Small comment in swarm
* Add closed_multiaddr to Replaced event
* Add address to NodeClosed and NodeError
* Fix concerns
* Remove StreamMuxer::boxed
* The SwarmFuture is now a Stream
* Return the produced future in the message
* Remove IncomingConnection event
* Pass error when failing to dial
* Fix loop break mistake
* Fix concern
* Rename SwarmFuture to SwarmEvents
* Increase type length limit
* Remove todo
* Stronger typing for the swarm handler future
* The swarm future is now a swarm stream of events
* Rewrite StreamMuxer in core
* Update libp2p_mplex for the new stream muxer
* Update yamux for new stream muxer
* Use Multihash and MultihashRef instead
* Don't use star imports
* Split EncodeError and DecodeError
* Add DecodeOwnedError
* Some cleanup
* Remove Hash::name()
* Some crate root documentation
* Add some more methods
* Fix tests
* Add PartialEq between Multihash and MultihashRef
* Fix the rest of the repo
* Rename hash_data() to digest()
* Add comment about varint
* Remove Error::description impls
* Rework swarm and allow interrupting a dial
* Improve the UniqueConnec situation
* Remove UniqueConnec::get
* Rename `get_or_dial()` to `dial()` and add `dial_if_empty()`
* Clean the UniqueConnec is the future is dropped
* Rename `set_until` to `tie_or_stop` and add `tie_or_passthrough`
* Add some tests, docs
* Fix memory leak with tasks registration
* Interrupt dialing when a UniqueConnec is dropped or cleared
* Add memory transport.
* Change test to be compatible with rust stable.
* Address concerns
* Add some documentation and minor fixes
* Move transport test to memory module