Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# 0.33.0 [unreleased]

- Have methods on `Transport` take `&mut self` instead of `self`. See [PR 2529].
- 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

# 0.32.1
Expand Down
6 changes: 3 additions & 3 deletions core/src/either.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,10 @@ where
}
}

fn close(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
fn poll_close(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
match self {
EitherOutput::First(inner) => inner.close(cx).map_err(|e| e.into()),
EitherOutput::Second(inner) => inner.close(cx).map_err(|e| e.into()),
EitherOutput::First(inner) => inner.poll_close(cx).map_err(|e| e.into()),
EitherOutput::Second(inner) => inner.poll_close(cx).map_err(|e| e.into()),
}
}

Expand Down
10 changes: 5 additions & 5 deletions core/src/muxing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ pub trait StreamMuxer {
/// > that the remote is properly informed of the shutdown. However, apart from
/// > properly informing the remote, there is no difference between this and
/// > immediately dropping the muxer.
fn close(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>;
fn poll_close(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>;

/// Flush this `StreamMuxer`.
///
Expand Down Expand Up @@ -606,8 +606,8 @@ impl StreamMuxer for StreamMuxerBox {
}

#[inline]
fn close(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
self.inner.close(cx)
fn poll_close(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
self.inner.poll_close(cx)
}

#[inline]
Expand Down Expand Up @@ -747,8 +747,8 @@ where
}

#[inline]
fn close(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
self.inner.close(cx).map_err(|e| e.into())
fn poll_close(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
self.inner.poll_close(cx).map_err(|e| e.into())
}

#[inline]
Expand Down
2 changes: 1 addition & 1 deletion core/src/muxing/singleton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ where

fn destroy_substream(&self, _: Self::Substream) {}

fn close(&self, cx: &mut Context<'_>) -> Poll<Result<(), io::Error>> {
fn poll_close(&self, cx: &mut Context<'_>) -> Poll<Result<(), io::Error>> {
// The `StreamMuxer` trait requires that `close()` implies `flush_all()`.
self.flush_all(cx)
}
Expand Down
2 changes: 1 addition & 1 deletion core/tests/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ where
loop {
match std::mem::replace(&mut self.state, CloseMuxerState::Done) {
CloseMuxerState::Close(muxer) => {
if !muxer.close(cx)?.is_ready() {
if !muxer.poll_close(cx)?.is_ready() {
self.state = CloseMuxerState::Close(muxer);
return Poll::Pending;
}
Expand Down
2 changes: 1 addition & 1 deletion muxers/mplex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ where
self.io.lock().drop_stream(sub.id);
}

fn close(&self, cx: &mut Context<'_>) -> Poll<Result<(), io::Error>> {
fn poll_close(&self, cx: &mut Context<'_>) -> Poll<Result<(), io::Error>> {
self.io.lock().poll_close(cx)
}

Expand Down
2 changes: 1 addition & 1 deletion muxers/yamux/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ where

fn destroy_substream(&self, _: Self::Substream) {}

fn close(&self, c: &mut Context<'_>) -> Poll<YamuxResult<()>> {
fn poll_close(&self, c: &mut Context<'_>) -> Poll<YamuxResult<()>> {
let mut inner = self.0.lock();
if let std::task::Poll::Ready(x) = Pin::new(&mut inner.control).poll_close(c) {
return Poll::Ready(x.map_err(YamuxError));
Expand Down
2 changes: 1 addition & 1 deletion swarm/src/connection/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ where
if let Err(error) = error {
self.spawn(
poll_fn(move |cx| {
if let Err(e) = ready!(muxer.close(cx)) {
if let Err(e) = ready!(muxer.poll_close(cx)) {
log::debug!(
"Failed to close connection {:?} to peer {}: {:?}",
id,
Expand Down
2 changes: 1 addition & 1 deletion swarm/src/connection/substream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ where
type Output = Result<(), IoError>;

fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
match self.muxer.close(cx) {
match self.muxer.poll_close(cx) {
Poll::Pending => Poll::Pending,
Poll::Ready(Ok(())) => Poll::Ready(Ok(())),
Poll::Ready(Err(err)) => Poll::Ready(Err(err.into())),
Expand Down