Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

Version change to 0.23.2 #1071

Merged
merged 3 commits into from
Jun 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Routing - Change Log

## [0.23.2]
- Don't cache as a member of recipient group: this can cause redundant
responses.
- Disconnect previous bootstrap node when retrying to bootstrap.

## [0.23.1]
- Fix tests involving sorting nodes by names.
- Fix random seeds when multiple tests are run at once.
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "GPL-3.0"
name = "routing"
readme = "README.md"
repository = "https://github.com/maidsafe/routing"
version = "0.23.1"
version = "0.23.2"

[dependencies]
accumulator = "~0.4.0"
Expand Down
23 changes: 8 additions & 15 deletions src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,11 +845,14 @@ impl Core {
}

if self.state == State::Node {
if self.routing_table.is_close(routing_msg.dst.name(), GROUP_SIZE) {
try!(self.signed_msg_security_check(&signed_msg));
}

if try!(self.respond_from_cache(&routing_msg, route)) {
if self.is_recipient(&routing_msg.dst) {
// TODO: If group, verify the sender's membership.
if let Authority::Client { ref client_key, .. } = signed_msg.routing_message().src {
if client_key != signed_msg.public_id().signing_public_key() {
return Err(RoutingError::FailedSignature);
};
}
} else if try!(self.respond_from_cache(&routing_msg, route)) {
return Ok(());
}

Expand All @@ -869,16 +872,6 @@ impl Core {
}
}

fn signed_msg_security_check(&self, signed_msg: &SignedMessage) -> Result<(), RoutingError> {
// TODO: If group, verify the sender's membership.
if let Authority::Client { ref client_key, .. } = signed_msg.routing_message().src {
if client_key != signed_msg.public_id().signing_public_key() {
return Err(RoutingError::FailedSignature);
};
}
Ok(())
}

fn respond_from_cache(&mut self,
routing_msg: &RoutingMessage,
route: u8)
Expand Down
12 changes: 5 additions & 7 deletions src/core_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1224,16 +1224,14 @@ fn request_during_churn_group_to_group() {
// Generate random immutable data, but make sure the first node in the given
// node slice (the proxy node) is not the closest to the data. Also sorts
// the nodes by distance to the data.
fn gen_immutable_data_not_closest_to_first_node<T: Rng>(rng: &mut T,
nodes: &mut [TestNode])
-> Data {
fn gen_immutable_data_not_close_to_first_node<T: Rng>(rng: &mut T, nodes: &mut [TestNode]) -> Data {
let first_name = nodes[0].name();

loop {
let data = gen_immutable_data(rng, 8);
sort_nodes_by_distance_to(nodes, &data.name());

if first_name != nodes[0].name() {
if nodes.iter().take(GROUP_SIZE).all(|node| node.name() != first_name) {
return data;
}
}
Expand All @@ -1244,7 +1242,7 @@ fn response_caching() {
let network = Network::new(None);

let mut rng = network.new_rng();
let mut nodes = create_connected_nodes_with_cache(&network, GROUP_SIZE + 1, true);
let mut nodes = create_connected_nodes_with_cache(&network, GROUP_SIZE * 2, true);
let mut clients = create_connected_clients(&network, &mut nodes, 1);

let proxy_node_name = nodes[0].name();
Expand All @@ -1253,9 +1251,9 @@ fn response_caching() {
// because in that case the full response (as opposed to just a hash of it)
// would originate from the proxy node and would never be relayed by it, thus
// it would never be stored in the cache.
let data = gen_immutable_data_not_closest_to_first_node(&mut rng, &mut nodes);
let data_name = data.name();
let data = gen_immutable_data_not_close_to_first_node(&mut rng, &mut nodes);
let data_id = data.identifier();
let data_name = data_id.name();
let message_id = MessageId::new();
let dst = Authority::NaeManager(data_name);

Expand Down