mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-14 02:21:21 +00:00
chore(request-response): remove deprecated items
Related: https://github.com/libp2p/rust-libp2p/issues/3647. Pull-Request: #3703.
This commit is contained in:
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
- Raise MSRV to 1.65.
|
- Raise MSRV to 1.65.
|
||||||
See [PR 3715].
|
See [PR 3715].
|
||||||
|
- Remove deprecated `RequestResponse` prefixed items. See [PR 3702].
|
||||||
|
|
||||||
[PR 3715]: https://github.com/libp2p/rust-libp2p/pull/3715
|
[PR 3715]: https://github.com/libp2p/rust-libp2p/pull/3715
|
||||||
|
[PR 3702]: https://github.com/libp2p/rust-libp2p/pull/3702
|
||||||
|
|
||||||
## 0.24.1
|
## 0.24.1
|
||||||
|
|
||||||
|
80
protocols/request-response/src/codec.rs
Normal file
80
protocols/request-response/src/codec.rs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
// Copyright 2020 Parity Technologies (UK) Ltd.
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
|
// to deal in the Software without restriction, including without limitation
|
||||||
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in
|
||||||
|
// all copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
pub use libp2p_core::ProtocolName;
|
||||||
|
|
||||||
|
use async_trait::async_trait;
|
||||||
|
use futures::prelude::*;
|
||||||
|
use std::io;
|
||||||
|
|
||||||
|
/// A `Codec` defines the request and response types
|
||||||
|
/// for a request-response [`Behaviour`](crate::Behaviour) protocol or
|
||||||
|
/// protocol family and how they are encoded / decoded on an I/O stream.
|
||||||
|
#[async_trait]
|
||||||
|
pub trait Codec {
|
||||||
|
/// The type of protocol(s) or protocol versions being negotiated.
|
||||||
|
type Protocol: ProtocolName + Send + Clone;
|
||||||
|
/// The type of inbound and outbound requests.
|
||||||
|
type Request: Send;
|
||||||
|
/// The type of inbound and outbound responses.
|
||||||
|
type Response: Send;
|
||||||
|
|
||||||
|
/// Reads a request from the given I/O stream according to the
|
||||||
|
/// negotiated protocol.
|
||||||
|
async fn read_request<T>(
|
||||||
|
&mut self,
|
||||||
|
protocol: &Self::Protocol,
|
||||||
|
io: &mut T,
|
||||||
|
) -> io::Result<Self::Request>
|
||||||
|
where
|
||||||
|
T: AsyncRead + Unpin + Send;
|
||||||
|
|
||||||
|
/// Reads a response from the given I/O stream according to the
|
||||||
|
/// negotiated protocol.
|
||||||
|
async fn read_response<T>(
|
||||||
|
&mut self,
|
||||||
|
protocol: &Self::Protocol,
|
||||||
|
io: &mut T,
|
||||||
|
) -> io::Result<Self::Response>
|
||||||
|
where
|
||||||
|
T: AsyncRead + Unpin + Send;
|
||||||
|
|
||||||
|
/// Writes a request to the given I/O stream according to the
|
||||||
|
/// negotiated protocol.
|
||||||
|
async fn write_request<T>(
|
||||||
|
&mut self,
|
||||||
|
protocol: &Self::Protocol,
|
||||||
|
io: &mut T,
|
||||||
|
req: Self::Request,
|
||||||
|
) -> io::Result<()>
|
||||||
|
where
|
||||||
|
T: AsyncWrite + Unpin + Send;
|
||||||
|
|
||||||
|
/// Writes a response to the given I/O stream according to the
|
||||||
|
/// negotiated protocol.
|
||||||
|
async fn write_response<T>(
|
||||||
|
&mut self,
|
||||||
|
protocol: &Self::Protocol,
|
||||||
|
io: &mut T,
|
||||||
|
res: Self::Response,
|
||||||
|
) -> io::Result<()>
|
||||||
|
where
|
||||||
|
T: AsyncWrite + Unpin + Send;
|
||||||
|
}
|
@ -1,199 +0,0 @@
|
|||||||
// Copyright 2020 Parity Technologies (UK) Ltd.
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
|
||||||
// to deal in the Software without restriction, including without limitation
|
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in
|
|
||||||
// all copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
||||||
// DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
pub use libp2p_core::ProtocolName;
|
|
||||||
|
|
||||||
use async_trait::async_trait;
|
|
||||||
use futures::prelude::*;
|
|
||||||
use std::io;
|
|
||||||
|
|
||||||
/// A `RequestResponseCodec` defines the request and response types
|
|
||||||
/// for a request-response `Behaviour` protocol or
|
|
||||||
/// protocol family and how they are encoded / decoded on an I/O stream.
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.24.0",
|
|
||||||
note = "Use re-exports that omit `RequestResponse` prefix, i.e. `libp2p::request_response::Codec`"
|
|
||||||
)]
|
|
||||||
#[async_trait]
|
|
||||||
pub trait RequestResponseCodec {
|
|
||||||
/// The type of protocol(s) or protocol versions being negotiated.
|
|
||||||
type Protocol: ProtocolName + Send + Clone;
|
|
||||||
/// The type of inbound and outbound requests.
|
|
||||||
type Request: Send;
|
|
||||||
/// The type of inbound and outbound responses.
|
|
||||||
type Response: Send;
|
|
||||||
|
|
||||||
/// Reads a request from the given I/O stream according to the
|
|
||||||
/// negotiated protocol.
|
|
||||||
async fn read_request<T>(
|
|
||||||
&mut self,
|
|
||||||
protocol: &Self::Protocol,
|
|
||||||
io: &mut T,
|
|
||||||
) -> io::Result<Self::Request>
|
|
||||||
where
|
|
||||||
T: AsyncRead + Unpin + Send;
|
|
||||||
|
|
||||||
/// Reads a response from the given I/O stream according to the
|
|
||||||
/// negotiated protocol.
|
|
||||||
async fn read_response<T>(
|
|
||||||
&mut self,
|
|
||||||
protocol: &Self::Protocol,
|
|
||||||
io: &mut T,
|
|
||||||
) -> io::Result<Self::Response>
|
|
||||||
where
|
|
||||||
T: AsyncRead + Unpin + Send;
|
|
||||||
|
|
||||||
/// Writes a request to the given I/O stream according to the
|
|
||||||
/// negotiated protocol.
|
|
||||||
async fn write_request<T>(
|
|
||||||
&mut self,
|
|
||||||
protocol: &Self::Protocol,
|
|
||||||
io: &mut T,
|
|
||||||
req: Self::Request,
|
|
||||||
) -> io::Result<()>
|
|
||||||
where
|
|
||||||
T: AsyncWrite + Unpin + Send;
|
|
||||||
|
|
||||||
/// Writes a response to the given I/O stream according to the
|
|
||||||
/// negotiated protocol.
|
|
||||||
async fn write_response<T>(
|
|
||||||
&mut self,
|
|
||||||
protocol: &Self::Protocol,
|
|
||||||
io: &mut T,
|
|
||||||
res: Self::Response,
|
|
||||||
) -> io::Result<()>
|
|
||||||
where
|
|
||||||
T: AsyncWrite + Unpin + Send;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A `Codec` defines the request and response types
|
|
||||||
/// for a request-response [`Behaviour`](crate::Behaviour) protocol or
|
|
||||||
/// protocol family and how they are encoded / decoded on an I/O stream.
|
|
||||||
#[async_trait]
|
|
||||||
pub trait Codec {
|
|
||||||
/// The type of protocol(s) or protocol versions being negotiated.
|
|
||||||
type Protocol: ProtocolName + Send + Clone;
|
|
||||||
/// The type of inbound and outbound requests.
|
|
||||||
type Request: Send;
|
|
||||||
/// The type of inbound and outbound responses.
|
|
||||||
type Response: Send;
|
|
||||||
|
|
||||||
/// Reads a request from the given I/O stream according to the
|
|
||||||
/// negotiated protocol.
|
|
||||||
async fn read_request<T>(
|
|
||||||
&mut self,
|
|
||||||
protocol: &Self::Protocol,
|
|
||||||
io: &mut T,
|
|
||||||
) -> io::Result<Self::Request>
|
|
||||||
where
|
|
||||||
T: AsyncRead + Unpin + Send;
|
|
||||||
|
|
||||||
/// Reads a response from the given I/O stream according to the
|
|
||||||
/// negotiated protocol.
|
|
||||||
async fn read_response<T>(
|
|
||||||
&mut self,
|
|
||||||
protocol: &Self::Protocol,
|
|
||||||
io: &mut T,
|
|
||||||
) -> io::Result<Self::Response>
|
|
||||||
where
|
|
||||||
T: AsyncRead + Unpin + Send;
|
|
||||||
|
|
||||||
/// Writes a request to the given I/O stream according to the
|
|
||||||
/// negotiated protocol.
|
|
||||||
async fn write_request<T>(
|
|
||||||
&mut self,
|
|
||||||
protocol: &Self::Protocol,
|
|
||||||
io: &mut T,
|
|
||||||
req: Self::Request,
|
|
||||||
) -> io::Result<()>
|
|
||||||
where
|
|
||||||
T: AsyncWrite + Unpin + Send;
|
|
||||||
|
|
||||||
/// Writes a response to the given I/O stream according to the
|
|
||||||
/// negotiated protocol.
|
|
||||||
async fn write_response<T>(
|
|
||||||
&mut self,
|
|
||||||
protocol: &Self::Protocol,
|
|
||||||
io: &mut T,
|
|
||||||
res: Self::Response,
|
|
||||||
) -> io::Result<()>
|
|
||||||
where
|
|
||||||
T: AsyncWrite + Unpin + Send;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[allow(deprecated)]
|
|
||||||
#[async_trait]
|
|
||||||
impl<U> Codec for U
|
|
||||||
where
|
|
||||||
U: RequestResponseCodec + Send,
|
|
||||||
U::Protocol: Sync,
|
|
||||||
{
|
|
||||||
type Protocol = U::Protocol;
|
|
||||||
|
|
||||||
type Request = U::Request;
|
|
||||||
|
|
||||||
type Response = U::Response;
|
|
||||||
|
|
||||||
async fn read_request<T>(
|
|
||||||
&mut self,
|
|
||||||
protocol: &Self::Protocol,
|
|
||||||
io: &mut T,
|
|
||||||
) -> io::Result<Self::Request>
|
|
||||||
where
|
|
||||||
T: AsyncRead + Unpin + Send,
|
|
||||||
{
|
|
||||||
self.read_request(protocol, io).await
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn read_response<T>(
|
|
||||||
&mut self,
|
|
||||||
protocol: &Self::Protocol,
|
|
||||||
io: &mut T,
|
|
||||||
) -> io::Result<Self::Response>
|
|
||||||
where
|
|
||||||
T: AsyncRead + Unpin + Send,
|
|
||||||
{
|
|
||||||
self.read_response(protocol, io).await
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn write_request<T>(
|
|
||||||
&mut self,
|
|
||||||
protocol: &Self::Protocol,
|
|
||||||
io: &mut T,
|
|
||||||
req: Self::Request,
|
|
||||||
) -> io::Result<()>
|
|
||||||
where
|
|
||||||
T: AsyncWrite + Unpin + Send,
|
|
||||||
{
|
|
||||||
self.write_request(protocol, io, req).await
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn write_response<T>(
|
|
||||||
&mut self,
|
|
||||||
protocol: &Self::Protocol,
|
|
||||||
io: &mut T,
|
|
||||||
res: Self::Response,
|
|
||||||
) -> io::Result<()>
|
|
||||||
where
|
|
||||||
T: AsyncWrite + Unpin + Send,
|
|
||||||
{
|
|
||||||
self.write_response(protocol, io, res).await
|
|
||||||
}
|
|
||||||
}
|
|
@ -18,20 +18,21 @@
|
|||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
mod protocol;
|
pub(crate) mod protocol;
|
||||||
|
|
||||||
use crate::codec_priv::Codec;
|
pub use protocol::ProtocolSupport;
|
||||||
|
|
||||||
|
use crate::codec::Codec;
|
||||||
|
use crate::handler::protocol::{RequestProtocol, ResponseProtocol};
|
||||||
use crate::{RequestId, EMPTY_QUEUE_SHRINK_THRESHOLD};
|
use crate::{RequestId, EMPTY_QUEUE_SHRINK_THRESHOLD};
|
||||||
|
|
||||||
use libp2p_swarm::handler::{
|
|
||||||
ConnectionEvent, DialUpgradeError, FullyNegotiatedInbound, FullyNegotiatedOutbound,
|
|
||||||
ListenUpgradeError,
|
|
||||||
};
|
|
||||||
pub use protocol::{ProtocolSupport, RequestProtocol, ResponseProtocol};
|
|
||||||
|
|
||||||
use futures::{channel::oneshot, future::BoxFuture, prelude::*, stream::FuturesUnordered};
|
use futures::{channel::oneshot, future::BoxFuture, prelude::*, stream::FuturesUnordered};
|
||||||
use instant::Instant;
|
use instant::Instant;
|
||||||
use libp2p_core::upgrade::{NegotiationError, UpgradeError};
|
use libp2p_core::upgrade::{NegotiationError, UpgradeError};
|
||||||
|
use libp2p_swarm::handler::{
|
||||||
|
ConnectionEvent, DialUpgradeError, FullyNegotiatedInbound, FullyNegotiatedOutbound,
|
||||||
|
ListenUpgradeError,
|
||||||
|
};
|
||||||
use libp2p_swarm::{
|
use libp2p_swarm::{
|
||||||
handler::{ConnectionHandler, ConnectionHandlerEvent, ConnectionHandlerUpgrErr, KeepAlive},
|
handler::{ConnectionHandler, ConnectionHandlerEvent, ConnectionHandlerUpgrErr, KeepAlive},
|
||||||
SubstreamProtocol,
|
SubstreamProtocol,
|
||||||
@ -48,12 +49,6 @@ use std::{
|
|||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.24.0",
|
|
||||||
note = "Use re-exports that omit `RequestResponse` prefix, i.e. `libp2p::request_response::handler::Handler`"
|
|
||||||
)]
|
|
||||||
pub type RequestResponseHandler<TCodec> = Handler<TCodec>;
|
|
||||||
|
|
||||||
/// A connection handler for a request response [`Behaviour`](super::Behaviour) protocol.
|
/// A connection handler for a request response [`Behaviour`](super::Behaviour) protocol.
|
||||||
pub struct Handler<TCodec>
|
pub struct Handler<TCodec>
|
||||||
where
|
where
|
||||||
@ -193,12 +188,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.24.0",
|
|
||||||
note = "Use re-exports that omit `RequestResponse` prefix, i.e. `libp2p::request_response::handler::Event`"
|
|
||||||
)]
|
|
||||||
pub type RequestResponseHandlerEvent<TCodec> = Event<TCodec>;
|
|
||||||
|
|
||||||
/// The events emitted by the [`Handler`].
|
/// The events emitted by the [`Handler`].
|
||||||
pub enum Event<TCodec>
|
pub enum Event<TCodec>
|
||||||
where
|
where
|
@ -23,7 +23,7 @@
|
|||||||
//! receives a request and sends a response, whereas the
|
//! receives a request and sends a response, whereas the
|
||||||
//! outbound upgrade send a request and receives a response.
|
//! outbound upgrade send a request and receives a response.
|
||||||
|
|
||||||
use crate::codec_priv::Codec;
|
use crate::codec::Codec;
|
||||||
use crate::RequestId;
|
use crate::RequestId;
|
||||||
|
|
||||||
use futures::{channel::oneshot, future::BoxFuture, prelude::*};
|
use futures::{channel::oneshot, future::BoxFuture, prelude::*};
|
@ -58,31 +58,15 @@
|
|||||||
|
|
||||||
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
|
||||||
|
|
||||||
mod codec_priv;
|
mod codec;
|
||||||
#[deprecated(
|
mod handler;
|
||||||
note = "The `codec` module will be made private in the future and should not be depended on."
|
|
||||||
)]
|
|
||||||
pub mod codec {
|
|
||||||
pub use super::codec_priv::*;
|
|
||||||
}
|
|
||||||
|
|
||||||
mod handler_priv;
|
pub use codec::{Codec, ProtocolName};
|
||||||
#[deprecated(
|
pub use handler::ProtocolSupport;
|
||||||
note = "The `handler` module will be made private in the future and should not be depended on."
|
|
||||||
)]
|
|
||||||
pub mod handler {
|
|
||||||
pub use super::handler_priv::*;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub use codec_priv::{Codec, ProtocolName};
|
|
||||||
|
|
||||||
#[allow(deprecated)]
|
|
||||||
pub use codec_priv::RequestResponseCodec;
|
|
||||||
|
|
||||||
pub use handler_priv::ProtocolSupport;
|
|
||||||
|
|
||||||
|
use crate::handler::protocol::RequestProtocol;
|
||||||
use futures::channel::oneshot;
|
use futures::channel::oneshot;
|
||||||
use handler_priv::{Handler, RequestProtocol};
|
use handler::Handler;
|
||||||
use libp2p_core::{ConnectedPoint, Endpoint, Multiaddr};
|
use libp2p_core::{ConnectedPoint, Endpoint, Multiaddr};
|
||||||
use libp2p_identity::PeerId;
|
use libp2p_identity::PeerId;
|
||||||
use libp2p_swarm::{
|
use libp2p_swarm::{
|
||||||
@ -100,37 +84,6 @@ use std::{
|
|||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.24.0",
|
|
||||||
note = "Use libp2p::request_response::Behaviour instead."
|
|
||||||
)]
|
|
||||||
pub type RequestResponse<TCodec> = Behaviour<TCodec>;
|
|
||||||
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.24.0",
|
|
||||||
note = "Use re-exports that omit `RequestResponse` prefix, i.e. `libp2p::request_response::Config`"
|
|
||||||
)]
|
|
||||||
pub type RequestResponseConfig = Config;
|
|
||||||
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.24.0",
|
|
||||||
note = "Use re-exports that omit `RequestResponse` prefix, i.e. `libp2p::request_response::Event`"
|
|
||||||
)]
|
|
||||||
pub type RequestResponseEvent<TRequest, TResponse> = Event<TRequest, TResponse>;
|
|
||||||
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.24.0",
|
|
||||||
note = "Use re-exports that omit `RequestResponse` prefix, i.e. `libp2p::request_response::Message`"
|
|
||||||
)]
|
|
||||||
pub type RequestResponseMessage<TRequest, TResponse, TChannelResponse> =
|
|
||||||
Message<TRequest, TResponse, TChannelResponse>;
|
|
||||||
|
|
||||||
#[deprecated(
|
|
||||||
since = "0.24.0",
|
|
||||||
note = "Use re-exports that omit `RequestResponse` prefix, i.e. `libp2p::request_response::handler::Event`"
|
|
||||||
)]
|
|
||||||
pub type HandlerEvent<TCodec> = handler_priv::Event<TCodec>;
|
|
||||||
|
|
||||||
/// An inbound request or response.
|
/// An inbound request or response.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Message<TRequest, TResponse, TChannelResponse = TResponse> {
|
pub enum Message<TRequest, TResponse, TChannelResponse = TResponse> {
|
||||||
@ -815,7 +768,7 @@ where
|
|||||||
event: THandlerOutEvent<Self>,
|
event: THandlerOutEvent<Self>,
|
||||||
) {
|
) {
|
||||||
match event {
|
match event {
|
||||||
handler_priv::Event::Response {
|
handler::Event::Response {
|
||||||
request_id,
|
request_id,
|
||||||
response,
|
response,
|
||||||
} => {
|
} => {
|
||||||
@ -832,7 +785,7 @@ where
|
|||||||
self.pending_events
|
self.pending_events
|
||||||
.push_back(ToSwarm::GenerateEvent(Event::Message { peer, message }));
|
.push_back(ToSwarm::GenerateEvent(Event::Message { peer, message }));
|
||||||
}
|
}
|
||||||
handler_priv::Event::Request {
|
handler::Event::Request {
|
||||||
request_id,
|
request_id,
|
||||||
request,
|
request,
|
||||||
sender,
|
sender,
|
||||||
@ -863,7 +816,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handler_priv::Event::ResponseSent(request_id) => {
|
handler::Event::ResponseSent(request_id) => {
|
||||||
let removed = self.remove_pending_outbound_response(&peer, connection, request_id);
|
let removed = self.remove_pending_outbound_response(&peer, connection, request_id);
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
removed,
|
removed,
|
||||||
@ -876,7 +829,7 @@ where
|
|||||||
request_id,
|
request_id,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
handler_priv::Event::ResponseOmission(request_id) => {
|
handler::Event::ResponseOmission(request_id) => {
|
||||||
let removed = self.remove_pending_outbound_response(&peer, connection, request_id);
|
let removed = self.remove_pending_outbound_response(&peer, connection, request_id);
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
removed,
|
removed,
|
||||||
@ -890,7 +843,7 @@ where
|
|||||||
error: InboundFailure::ResponseOmission,
|
error: InboundFailure::ResponseOmission,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
handler_priv::Event::OutboundTimeout(request_id) => {
|
handler::Event::OutboundTimeout(request_id) => {
|
||||||
let removed = self.remove_pending_inbound_response(&peer, connection, &request_id);
|
let removed = self.remove_pending_inbound_response(&peer, connection, &request_id);
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
removed,
|
removed,
|
||||||
@ -904,7 +857,7 @@ where
|
|||||||
error: OutboundFailure::Timeout,
|
error: OutboundFailure::Timeout,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
handler_priv::Event::InboundTimeout(request_id) => {
|
handler::Event::InboundTimeout(request_id) => {
|
||||||
// Note: `Event::InboundTimeout` is emitted both for timing
|
// Note: `Event::InboundTimeout` is emitted both for timing
|
||||||
// out to receive the request and for timing out sending the response. In the former
|
// out to receive the request and for timing out sending the response. In the former
|
||||||
// case the request is never added to `pending_outbound_responses` and thus one can
|
// case the request is never added to `pending_outbound_responses` and thus one can
|
||||||
@ -918,7 +871,7 @@ where
|
|||||||
error: InboundFailure::Timeout,
|
error: InboundFailure::Timeout,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
handler_priv::Event::OutboundUnsupportedProtocols(request_id) => {
|
handler::Event::OutboundUnsupportedProtocols(request_id) => {
|
||||||
let removed = self.remove_pending_inbound_response(&peer, connection, &request_id);
|
let removed = self.remove_pending_inbound_response(&peer, connection, &request_id);
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
removed,
|
removed,
|
||||||
@ -932,7 +885,7 @@ where
|
|||||||
error: OutboundFailure::UnsupportedProtocols,
|
error: OutboundFailure::UnsupportedProtocols,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
handler_priv::Event::InboundUnsupportedProtocols(request_id) => {
|
handler::Event::InboundUnsupportedProtocols(request_id) => {
|
||||||
// Note: No need to call `self.remove_pending_outbound_response`,
|
// Note: No need to call `self.remove_pending_outbound_response`,
|
||||||
// `Event::Request` was never emitted for this request and
|
// `Event::Request` was never emitted for this request and
|
||||||
// thus request was never added to `pending_outbound_responses`.
|
// thus request was never added to `pending_outbound_responses`.
|
||||||
|
Reference in New Issue
Block a user