Files
pezkuwi-subxt/substrate/client/network-gossip/Cargo.toml
T
Max Inden 9201f8abf3 client/network-gossip/src/bridge: Finish when network event stream closes (#5282)
* client/network-gossip/src/bridge: Finish when network even stream closes

Previously within `<GossipEngine as Future>::poll` one would poll the
`network_event_stream` ignoring all messages other than
`Poll::Ready(Some())`. Ignoring `Poll::Ready(None)` leads to a panic on
the next poll of the stream, gien that it is not fused.

By design `network_event_stream` does not close unless an unbounded send
into it fails, or the `NetworkWorker` gets shut down.

> The stream never ends (unless the `NetworkWorker` gets shut down).
> (client/network/src/service.rs)

An `unbounded_send` to fail on an unbounded channel is unlikely. The
`NetworkWorker` shutting down is not unlikely. In such case the
`GossipEngine` should shut down as well.

With this patch a `<GossipEngine as Future>` finishes on
`Poll::Ready(None)` returned from `network_event_stream`.

* client/finality-grandpa/communication: Error on gossip engine finished

Have `<NetworkBridge as Future>::poll` return `Poll::Ready(Err)` instead
of `Poll::Ready(Ok)` to be consistent with the handling of the neighbor
packet worker stream and the gossip validator report stream. Both `Err`
as well as `Ok` shut down the `NetworkBridge` as well as the
`VoterWorker`.

* client/network-gossip/src/bridge: Add regression test

* client/network-gossip: Move substrate test client to dev dependencies

* client/network-gossip: Remove TODO

Addressed in a follow up pull request.

* client/network-gossip/bridge: Put match on newline after loop

* client/finality-grandpa/src/observer: Fix regression test

Make sure the event stream sender side is not dropped till the end.
2020-03-18 20:15:57 +01:00

25 lines
815 B
TOML

[package]
description = "Gossiping for the Substrate network protocol"
name = "sc-network-gossip"
version = "0.8.0-alpha.4"
license = "GPL-3.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
homepage = "https://substrate.dev"
repository = "https://github.com/paritytech/substrate/"
documentation = "https://docs.rs/sc-network-gossip"
[dependencies]
futures = "0.3.1"
futures-timer = "3.0.1"
libp2p = { version = "0.16.2", default-features = false, features = ["libp2p-websocket"] }
log = "0.4.8"
lru = "0.4.3"
sc-network = { version = "0.8.0-alpha.4", path = "../network" }
sp-runtime = { version = "2.0.0-alpha.4", path = "../../primitives/runtime" }
wasm-timer = "0.2"
[dev-dependencies]
substrate-test-runtime-client = { version = "2.0.0-dev", path = "../../test-utils/runtime/client" }