diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 407e0fe2ef9..a3ef14a42c1 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -1,12 +1,15 @@ # 0.33.0 [unreleased] - Have methods on `Transport` take `&mut self` instead of `self`. See [PR 2529]. +- Remove `StreamMuxer::flush_all`. See [PR 2669]. - Rename `StreamMuxer::close` to `StreamMuxer::poll_close`. See [PR 2666]. - Remove deprecated function `StreamMuxer::is_remote_acknowledged`. See [PR 2665]. [PR 2529]: https://github.com/libp2p/rust-libp2p/pull/2529 [PR 2666]: https://github.com/libp2p/rust-libp2p/pull/2666 [PR 2665]: https://github.com/libp2p/rust-libp2p/pull/2665 +[PR 2669]: https://github.com/libp2p/rust-libp2p/pull/2669 + # 0.32.1 diff --git a/core/src/either.rs b/core/src/either.rs index adeeaa94d15..1d0121e860e 100644 --- a/core/src/either.rs +++ b/core/src/either.rs @@ -352,13 +352,6 @@ where EitherOutput::Second(inner) => inner.poll_close(cx).map_err(|e| e.into()), } } - - fn flush_all(&self, cx: &mut Context<'_>) -> Poll> { - match self { - EitherOutput::First(inner) => inner.flush_all(cx).map_err(|e| e.into()), - EitherOutput::Second(inner) => inner.flush_all(cx).map_err(|e| e.into()), - } - } } #[derive(Debug, Copy, Clone)] diff --git a/core/src/muxing.rs b/core/src/muxing.rs index 4b38da23501..170a4537901 100644 --- a/core/src/muxing.rs +++ b/core/src/muxing.rs @@ -216,13 +216,6 @@ pub trait StreamMuxer { /// > properly informing the remote, there is no difference between this and /// > immediately dropping the muxer. fn poll_close(&self, cx: &mut Context<'_>) -> Poll>; - - /// Flush this `StreamMuxer`. - /// - /// This drains any write buffers of substreams and delivers any pending shutdown notifications - /// due to `shutdown_substream` or `close`. One may thus shutdown groups of substreams - /// followed by a final `flush_all` instead of having to do `flush_substream` for each. - fn flush_all(&self, cx: &mut Context<'_>) -> Poll>; } /// Event about a connection, reported by an implementation of [`StreamMuxer`]. @@ -609,11 +602,6 @@ impl StreamMuxer for StreamMuxerBox { fn poll_close(&self, cx: &mut Context<'_>) -> Poll> { self.inner.poll_close(cx) } - - #[inline] - fn flush_all(&self, cx: &mut Context<'_>) -> Poll> { - self.inner.flush_all(cx) - } } struct Wrap @@ -750,9 +738,4 @@ where fn poll_close(&self, cx: &mut Context<'_>) -> Poll> { self.inner.poll_close(cx).map_err(|e| e.into()) } - - #[inline] - fn flush_all(&self, cx: &mut Context<'_>) -> Poll> { - self.inner.flush_all(cx).map_err(|e| e.into()) - } } diff --git a/core/src/muxing/singleton.rs b/core/src/muxing/singleton.rs index 77ab0485ee9..529fa147f9c 100644 --- a/core/src/muxing/singleton.rs +++ b/core/src/muxing/singleton.rs @@ -149,12 +149,7 @@ where fn destroy_substream(&self, _: Self::Substream) {} - fn poll_close(&self, cx: &mut Context<'_>) -> Poll> { - // The `StreamMuxer` trait requires that `close()` implies `flush_all()`. - self.flush_all(cx) - } - - fn flush_all(&self, cx: &mut Context<'_>) -> Poll> { - AsyncWrite::poll_flush(Pin::new(&mut *self.inner.lock()), cx) + fn poll_close(&self, _cx: &mut Context<'_>) -> Poll> { + Poll::Ready(Ok(())) } } diff --git a/muxers/mplex/src/lib.rs b/muxers/mplex/src/lib.rs index 78db7218546..f2a95c21151 100644 --- a/muxers/mplex/src/lib.rs +++ b/muxers/mplex/src/lib.rs @@ -172,10 +172,6 @@ where fn poll_close(&self, cx: &mut Context<'_>) -> Poll> { self.io.lock().poll_close(cx) } - - fn flush_all(&self, cx: &mut Context<'_>) -> Poll> { - self.io.lock().poll_flush(cx) - } } /// Active attempt to open an outbound substream. diff --git a/muxers/yamux/src/lib.rs b/muxers/yamux/src/lib.rs index b77e3005b6e..6fd8adc1686 100644 --- a/muxers/yamux/src/lib.rs +++ b/muxers/yamux/src/lib.rs @@ -191,10 +191,6 @@ where } Poll::Pending } - - fn flush_all(&self, _: &mut Context<'_>) -> Poll> { - Poll::Ready(Ok(())) - } } /// The yamux configuration.