Unverified Commit c18d42d4 authored by Andronik Ordian's avatar Andronik Ordian Committed by GitHub
Browse files

req/resp: use IfDisconnected::ImmediateError (#4253)

* req/resp: use IfDisconnected::ImmediateError

* remove outdated comments

* fmt
parent 14be5d5e
Pipeline #165759 canceled with stages
in 11 minutes and 13 seconds
......@@ -64,10 +64,7 @@ where
ctx.send_message(NetworkBridgeMessage::SendRequests(
vec![full_req],
// We are supposed to be connected to validators of our group via `PeerSet`,
// but at session boundaries that is kind of racy, in case a connection takes
// longer to get established, so we try to connect in any case.
IfDisconnected::TryConnect,
IfDisconnected::ImmediateError,
))
.await;
......
......@@ -327,7 +327,7 @@ impl RunningTask {
self.sender
.send(FromFetchTask::Message(AllMessages::NetworkBridge(
NetworkBridgeMessage::SendRequests(vec![requests], IfDisconnected::TryConnect),
NetworkBridgeMessage::SendRequests(vec![requests], IfDisconnected::ImmediateError),
)))
.await
.map_err(|_| TaskError::ShuttingDown)?;
......
......@@ -230,7 +230,7 @@ impl TestRun {
match msg {
AllMessages::NetworkBridge(NetworkBridgeMessage::SendRequests(
reqs,
IfDisconnected::TryConnect,
IfDisconnected::ImmediateError,
)) => {
let mut valid_responses = 0;
for req in reqs {
......
......@@ -216,7 +216,7 @@ impl TestState {
match msg {
AllMessages::NetworkBridge(NetworkBridgeMessage::SendRequests(
reqs,
IfDisconnected::TryConnect,
IfDisconnected::ImmediateError,
)) => {
for req in reqs {
// Forward requests:
......
......@@ -201,7 +201,7 @@ impl RequestFromBackers {
.send_message(
NetworkBridgeMessage::SendRequests(
vec![Requests::AvailableDataFetching(req)],
IfDisconnected::TryConnect,
IfDisconnected::ImmediateError,
)
.into(),
)
......@@ -345,7 +345,7 @@ impl RequestChunksFromValidators {
sender
.send_message(
NetworkBridgeMessage::SendRequests(requests, IfDisconnected::TryConnect).into(),
NetworkBridgeMessage::SendRequests(requests, IfDisconnected::ImmediateError).into(),
)
.await;
}
......
......@@ -275,7 +275,7 @@ impl TestState {
AllMessages::NetworkBridge(
NetworkBridgeMessage::SendRequests(
requests,
IfDisconnected::TryConnect,
IfDisconnected::ImmediateError,
)
) => {
for req in requests {
......@@ -324,7 +324,7 @@ impl TestState {
AllMessages::NetworkBridge(
NetworkBridgeMessage::SendRequests(
mut requests,
IfDisconnected::TryConnect,
IfDisconnected::ImmediateError,
)
) => {
assert_eq!(requests.len(), 1);
......
......@@ -304,11 +304,7 @@ async fn send_requests<Context: SubsystemContext>(
statuses.insert(receiver, DeliveryStatus::Pending(remote_handle));
}
let msg = NetworkBridgeMessage::SendRequests(
reqs,
// We should be connected, but the hell - if not, try!
IfDisconnected::TryConnect,
);
let msg = NetworkBridgeMessage::SendRequests(reqs, IfDisconnected::ImmediateError);
ctx.send_message(AllMessages::NetworkBridge(msg)).await;
Ok(statuses)
}
......
......@@ -663,7 +663,7 @@ async fn check_sent_requests(
assert_matches!(
handle.recv().await,
AllMessages::NetworkBridge(
NetworkBridgeMessage::SendRequests(reqs, IfDisconnected::TryConnect)
NetworkBridgeMessage::SendRequests(reqs, IfDisconnected::ImmediateError)
) => {
let reqs: Vec<_> = reqs.into_iter().map(|r|
assert_matches!(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment