diff --git a/Cargo.lock b/Cargo.lock index 7ca3795ff3b..b2b90a3a005 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3236,7 +3236,7 @@ dependencies = [ [[package]] name = "libp2p-stream" -version = "0.1.0-alpha" +version = "0.1.0-alpha.1" dependencies = [ "futures", "libp2p-core", diff --git a/Cargo.toml b/Cargo.toml index 3d7097f9a88..23fd4774b55 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,7 +101,7 @@ libp2p-relay = { version = "0.17.1", path = "protocols/relay" } libp2p-rendezvous = { version = "0.14.0", path = "protocols/rendezvous" } libp2p-request-response = { version = "0.26.2", path = "protocols/request-response" } libp2p-server = { version = "0.12.6", path = "misc/server" } -libp2p-stream = { version = "0.1.0-alpha", path = "protocols/stream" } +libp2p-stream = { version = "0.1.0-alpha.1", path = "protocols/stream" } libp2p-swarm = { version = "0.44.2", path = "swarm" } libp2p-swarm-derive = { version = "=0.34.3", path = "swarm-derive" } # `libp2p-swarm-derive` may not be compatible with different `libp2p-swarm` non-breaking releases. E.g. `libp2p-swarm` might introduce a new enum variant `FromSwarm` (which is `#[non-exhaustive]`) in a non-breaking release. Older versions of `libp2p-swarm-derive` would not forward this enum variant within the `NetworkBehaviour` hierarchy. Thus the version pinning is required. libp2p-swarm-test = { version = "0.3.0", path = "swarm-test" } diff --git a/protocols/stream/CHANGELOG.md b/protocols/stream/CHANGELOG.md index 2e177e2f1bc..1e3b85da0b9 100644 --- a/protocols/stream/CHANGELOG.md +++ b/protocols/stream/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.0-alpha.1 +- Implement Error for `OpenStreamError`. + See [PR 5169](https://github.com/libp2p/rust-libp2p/pull/5169). + ## 0.1.0-alpha Initial release. diff --git a/protocols/stream/Cargo.toml b/protocols/stream/Cargo.toml index be340939720..6a39794c196 100644 --- a/protocols/stream/Cargo.toml +++ b/protocols/stream/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-stream" -version = "0.1.0-alpha" +version = "0.1.0-alpha.1" edition = "2021" rust-version.workspace = true description = "Generic stream protocols for libp2p" diff --git a/protocols/stream/src/control.rs b/protocols/stream/src/control.rs index 6aabaaff30e..036d285b2a3 100644 --- a/protocols/stream/src/control.rs +++ b/protocols/stream/src/control.rs @@ -103,6 +103,15 @@ impl fmt::Display for OpenStreamError { } } +impl std::error::Error for OpenStreamError { + fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { + match self { + Self::Io(error) => Some(error), + _ => None, + } + } +} + /// A handle to inbound streams for a particular protocol. #[must_use = "Streams do nothing unless polled."] pub struct IncomingStreams {