Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
client/network/request-response: Don't emit event on send_response fail
  • Loading branch information
mxinden committed Dec 9, 2020
commit bf0b186a158ea56ec034ee96d3dd5e0c46c3f4db
18 changes: 6 additions & 12 deletions client/network/src/request_responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,18 +361,13 @@ impl NetworkBehaviour for RequestResponsesBehaviour {
if let Some((protocol, _)) = self.protocols.get_mut(&*protocol_name) {
if let Err(_) = protocol.send_response(inner_channel, Ok(response)) {
self.pending_responses_arrival_time.pop(&request_id);
log::warn!(
log::debug!(
target: "sub-libp2p",
"Failed to send response for {:?} on protocol {:?}. Dropping \
response",
"Failed to send response for {:?} on protocol {:?} due to a \
timeout or due to the connection to the peer being closed. \
Dropping response",
request_id, protocol_name,
);
let out = Event::InboundRequest {
peer,
protocol: protocol_name,
result: Err(ResponseFailure::TimeoutOrClosed),
};
return Poll::Ready(NetworkBehaviourAction::GenerateEvent(out));
}
}
}
Expand Down Expand Up @@ -499,7 +494,8 @@ impl NetworkBehaviour for RequestResponsesBehaviour {
return Poll::Ready(NetworkBehaviourAction::GenerateEvent(out));
}

// Remote has tried to send a request but failed.
// An inbound request failed, either while reading the request or due to failing
// to send a response.
RequestResponseEvent::InboundFailure { request_id, peer, error, .. } => {
self.pending_responses_arrival_time.pop(&request_id);
let out = Event::InboundRequest {
Expand Down Expand Up @@ -566,8 +562,6 @@ pub enum RequestFailure {
pub enum ResponseFailure {
/// Internal response builder is too busy to process this request.
Busy,
/// Failed to respond in time or connection to peer is closed already.
TimeoutOrClosed,
/// Problem on the network.
#[display(fmt = "Problem on the network")]
Network(#[error(ignore)] InboundFailure),
Expand Down
1 change: 0 additions & 1 deletion client/network/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,6 @@ impl<B: BlockT + 'static, H: ExHashT> Future for NetworkWorker<B, H> {
Err(err) => {
let reason = match err {
ResponseFailure::Busy => "busy",
ResponseFailure::TimeoutOrClosed => "timeout-or-closed",
ResponseFailure::Network(InboundFailure::Timeout) => "timeout",
ResponseFailure::Network(InboundFailure::UnsupportedProtocols) =>
"unsupported",
Expand Down