mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-24 00:21:20 +00:00
core/muxing: Rename close
to poll_close
(#2666)
It is common practise to prefix functions that return a `Poll` with `poll_`.
This commit is contained in:
parent
8361fabb47
commit
25c8bc24de
@ -1,9 +1,11 @@
|
|||||||
# 0.33.0 [unreleased]
|
# 0.33.0 [unreleased]
|
||||||
|
|
||||||
- Have methods on `Transport` take `&mut self` instead of `self`. See [PR 2529].
|
- 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].
|
- Remove deprecated function `StreamMuxer::is_remote_acknowledged`. See [PR 2665].
|
||||||
|
|
||||||
[PR 2529]: https://github.com/libp2p/rust-libp2p/pull/2529
|
[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 2665]: https://github.com/libp2p/rust-libp2p/pull/2665
|
||||||
|
|
||||||
# 0.32.1
|
# 0.32.1
|
||||||
|
@ -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 {
|
match self {
|
||||||
EitherOutput::First(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.close(cx).map_err(|e| e.into()),
|
EitherOutput::Second(inner) => inner.poll_close(cx).map_err(|e| e.into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ pub trait StreamMuxer {
|
|||||||
/// > that the remote is properly informed of the shutdown. However, apart from
|
/// > that the remote is properly informed of the shutdown. However, apart from
|
||||||
/// > properly informing the remote, there is no difference between this and
|
/// > properly informing the remote, there is no difference between this and
|
||||||
/// > immediately dropping the muxer.
|
/// > 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`.
|
/// Flush this `StreamMuxer`.
|
||||||
///
|
///
|
||||||
@ -606,8 +606,8 @@ impl StreamMuxer for StreamMuxerBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn close(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_close(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
self.inner.close(cx)
|
self.inner.poll_close(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -747,8 +747,8 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn close(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
fn poll_close(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
|
||||||
self.inner.close(cx).map_err(|e| e.into())
|
self.inner.poll_close(cx).map_err(|e| e.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -149,7 +149,7 @@ where
|
|||||||
|
|
||||||
fn destroy_substream(&self, _: Self::Substream) {}
|
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()`.
|
// The `StreamMuxer` trait requires that `close()` implies `flush_all()`.
|
||||||
self.flush_all(cx)
|
self.flush_all(cx)
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ where
|
|||||||
loop {
|
loop {
|
||||||
match std::mem::replace(&mut self.state, CloseMuxerState::Done) {
|
match std::mem::replace(&mut self.state, CloseMuxerState::Done) {
|
||||||
CloseMuxerState::Close(muxer) => {
|
CloseMuxerState::Close(muxer) => {
|
||||||
if !muxer.close(cx)?.is_ready() {
|
if !muxer.poll_close(cx)?.is_ready() {
|
||||||
self.state = CloseMuxerState::Close(muxer);
|
self.state = CloseMuxerState::Close(muxer);
|
||||||
return Poll::Pending;
|
return Poll::Pending;
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ where
|
|||||||
self.io.lock().drop_stream(sub.id);
|
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)
|
self.io.lock().poll_close(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ where
|
|||||||
|
|
||||||
fn destroy_substream(&self, _: Self::Substream) {}
|
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();
|
let mut inner = self.0.lock();
|
||||||
if let std::task::Poll::Ready(x) = Pin::new(&mut inner.control).poll_close(c) {
|
if let std::task::Poll::Ready(x) = Pin::new(&mut inner.control).poll_close(c) {
|
||||||
return Poll::Ready(x.map_err(YamuxError));
|
return Poll::Ready(x.map_err(YamuxError));
|
||||||
|
@ -686,7 +686,7 @@ where
|
|||||||
if let Err(error) = error {
|
if let Err(error) = error {
|
||||||
self.spawn(
|
self.spawn(
|
||||||
poll_fn(move |cx| {
|
poll_fn(move |cx| {
|
||||||
if let Err(e) = ready!(muxer.close(cx)) {
|
if let Err(e) = ready!(muxer.poll_close(cx)) {
|
||||||
log::debug!(
|
log::debug!(
|
||||||
"Failed to close connection {:?} to peer {}: {:?}",
|
"Failed to close connection {:?} to peer {}: {:?}",
|
||||||
id,
|
id,
|
||||||
|
@ -211,7 +211,7 @@ where
|
|||||||
type Output = Result<(), IoError>;
|
type Output = Result<(), IoError>;
|
||||||
|
|
||||||
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
|
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::Pending => Poll::Pending,
|
||||||
Poll::Ready(Ok(())) => Poll::Ready(Ok(())),
|
Poll::Ready(Ok(())) => Poll::Ready(Ok(())),
|
||||||
Poll::Ready(Err(err)) => Poll::Ready(Err(err.into())),
|
Poll::Ready(Err(err)) => Poll::Ready(Err(err.into())),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user