mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-23 14:51:34 +00:00
protocols/request-response: Close response stream even if response cannot be sent (#1987)
Co-authored-by: Roman Borschel <romanb@users.noreply.github.com> Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
@ -106,6 +106,7 @@ where
|
||||
let write = self.codec.write_response(&protocol, &mut io, response);
|
||||
write.await?;
|
||||
} else {
|
||||
io.close().await?;
|
||||
return Ok(false)
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ pub enum RequestResponseEvent<TRequest, TResponse, TChannelResponse = TResponse>
|
||||
|
||||
/// Possible failures occurring in the context of sending
|
||||
/// an outbound request and receiving the response.
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum OutboundFailure {
|
||||
/// The request could not be sent because a dialing attempt failed.
|
||||
DialFailure,
|
||||
@ -183,7 +183,7 @@ pub enum OutboundFailure {
|
||||
|
||||
/// Possible failures occurring in the context of receiving an
|
||||
/// inbound request and sending a response.
|
||||
#[derive(Debug, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub enum InboundFailure {
|
||||
/// The inbound request timed out, either while reading the
|
||||
/// incoming request or before a response is sent, e.g. if
|
||||
|
Reference in New Issue
Block a user