7 Commits

Author SHA1 Message Date
Toralf Wittner
7016b86b3a
Add StreamMuxer::flush. (#534)
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`.
2018-10-11 10:35:14 +02:00
Pierre Krieger
063ab178a9
Add an alternative to the swarm (#472)
* 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
2018-09-14 13:18:10 +02:00
Guanqun Lu
ee9be6f0c9 add must_use for Future (#450) 2018-09-04 12:30:57 +02:00
Pierre Krieger
0e1483f02e Rework the StreamMuxer trait (#437)
* 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
2018-08-31 10:31:34 +02:00
Pierre Krieger
7b375798a5
The Multiaddr of the remote is now a Future (#249)
* The Multiaddr of the remote is now a Future

* The multiaddress future in swarm is now a Box
2018-06-19 14:38:55 +02:00
Pierre Krieger
a163e81e30
Rename EitherSocket to EitherOutput (#201) 2018-05-23 11:45:35 +02:00
Pierre Krieger
5c1890e66a
Rename libp2p_swarm to libp2p_core (#189) 2018-05-16 12:59:36 +02:00