This repository has been archived by the owner on Jun 25, 2021. It is now read-only.
Resend messages on failure #1705
Merged
Merged
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1a71fb2
fix/test: remove side-effect from lose_proxy_connection
pierrechevalier83 f486643
feat/mock: pretend quic-p2p exposes `SentUserMessage`
pierrechevalier83 83861e1
feat/mock-quic-p2p: revert temporary "fix"
fizyk20 25ab2c0
feat/base: add a trait method for handling unsent messages
fizyk20 f105667
feat/mock-qp2p: add msg ids
fizyk20 c477622
feat/base: add handle_sent_message
fizyk20 157d69b
feat/states: add targets cache
fizyk20 80cc9e4
feat/base: use the sending targets cache when sending
fizyk20 3ec99c8
feat/chain: update targets method to return potential targets
fizyk20 0ed1d85
chore/ci: temporarily disable prod builds on CI
fizyk20 65344b2
fix/mock-qp2p: always send pending messages upon connection
fizyk20 9a4becc
fix/all: fix clippy errors
fizyk20 65cb0d7
test/mock-qp2p: add assertions for SentUserMessage
fizyk20 b1ae98d
fix/sending_cache: fix the condition for dropping a message
fizyk20 5c81ebc
fix/all: address review comments
fizyk20 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1091,7 +1091,7 @@ impl Chain { | |
&self, | ||
dst: &Authority<XorName>, | ||
connected_peers: &[&XorName], | ||
) -> Result<BTreeSet<XorName>, Error> { | ||
) -> Result<(Vec<XorName>, usize), Error> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. better update the comment to explain what this |
||
// FIXME: only filtering for now to match RT. | ||
// should confirm if needed esp after msg_relay changes. | ||
let is_connected = |target_name: &XorName| connected_peers.contains(&target_name); | ||
|
@@ -1119,17 +1119,17 @@ impl Chain { | |
}) | ||
}; | ||
|
||
let (best_section_len, best_section) = match *dst { | ||
let (best_section_len, mut best_section) = match *dst { | ||
Authority::ManagedNode(ref target_name) | ||
| Authority::Client { | ||
proxy_node_name: ref target_name, | ||
.. | ||
} => { | ||
if target_name == self.our_id().name() { | ||
return Ok(BTreeSet::new()); | ||
return Ok((Vec::new(), 0)); | ||
} | ||
if self.has(target_name) && is_connected(&target_name) { | ||
return Ok(iter::once(*target_name).collect()); | ||
return Ok((vec![*target_name], 1)); | ||
} | ||
candidates(target_name)? | ||
} | ||
|
@@ -1139,7 +1139,8 @@ impl Chain { | |
if let Some(group) = | ||
self.other_closest_names(target_name, self.min_sec_size, &connected_peers) | ||
{ | ||
return Ok(group.into_iter().collect()); | ||
let group_len = group.len(); | ||
return Ok((group, group_len)); | ||
} | ||
candidates(target_name)? | ||
} | ||
|
@@ -1152,8 +1153,9 @@ impl Chain { | |
|
||
// FIXME: only doing this for now to match RT. | ||
// should confirm if needed esp after msg_relay changes. | ||
section = section.into_iter().filter(is_connected).collect(); | ||
return Ok(section); | ||
let section: Vec<_> = section.into_iter().filter(is_connected).collect(); | ||
let dg_size = section.len(); | ||
return Ok((section, dg_size)); | ||
} | ||
candidates(target_name)? | ||
} | ||
|
@@ -1174,24 +1176,23 @@ impl Chain { | |
} | ||
}; | ||
|
||
let mut targets = Iterator::flatten( | ||
let targets = Iterator::flatten( | ||
self.all_sections() | ||
.filter_map(is_compatible) | ||
.map(SectionInfo::member_names), | ||
) | ||
.filter(is_connected) | ||
.collect::<BTreeSet<_>>(); | ||
let _ = targets.remove(&self.our_id().name()); | ||
return Ok(targets); | ||
.filter(|name| name != self.our_id().name()) | ||
.collect::<Vec<_>>(); | ||
let dg_size = targets.len(); | ||
return Ok((targets, dg_size)); | ||
} | ||
candidates(&prefix.lower_bound())? | ||
} | ||
}; | ||
Ok(best_section | ||
.into_iter() | ||
.filter(|&x| x != *self.our_id().name()) | ||
.take(delivery_group_size(best_section_len)) | ||
.collect()) | ||
|
||
best_section.retain(|&x| x != *self.our_id().name()); | ||
Ok((best_section, delivery_group_size(best_section_len))) | ||
} | ||
|
||
/// Returns our own section, including our own name. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this to be commented out?
if does not required any more?
shall it be removed, instead of comment out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's temporary - this is because the non-mock code no longer compiles until
quic-p2p
's API is updated to match what we did here inmock-quic-p2p
. Oncequic-p2p
is updated, this will be restored.