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

MAID-1957 test/tunnel: tunnel client reconnect #1355

Merged
merged 1 commit into from Feb 28, 2017

Conversation

maqi
Copy link
Member

@maqi maqi commented Feb 13, 2017

No description provided.

@maidsafe-highfive
Copy link

r? @afck

(maidsafe_highfive has picked a reviewer for you, use r? to override)

@maqi maqi force-pushed the tunnel_test_tryout branch 2 times, most recently from 4de7e70 to 1a61073 Compare February 13, 2017 12:02
@Viv-Rajkumar Viv-Rajkumar changed the title MAID-1957 test/tunnel: tunnel client reconnect Paused - MAID-1957 test/tunnel: tunnel client reconnect Feb 14, 2017
@Viv-Rajkumar Viv-Rajkumar changed the title Paused - MAID-1957 test/tunnel: tunnel client reconnect MAID-1957 test/tunnel: tunnel client reconnect Feb 20, 2017
Copy link
Contributor

@Fraser999 Fraser999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some general points for now:

  • I'd rather we avoid the changes that have been made to node.rs, peer_manager.rs and states/node.rs. I think we could modify the mock crust framework to enable the blocking/dropping of tunnelled connections there, and just allow the production code to take care of handling the generated crust events. And for reconnecting, we could use the RT request mechanism (although I'm slightly less worried about the exposure of send_connect_request() since it doesn't seem to be quite as intrusive as the remove_peer() function).
  • If we take this approach, then in the tests, when we remove a connection we can check for a NodeLost event, and likewise if the connection gets re-established we can check for a NodeAdded event. Just doing the invariant check at each stage doesn't really tell us whether anything changed at all in the network during that stage.

@maqi maqi force-pushed the tunnel_test_tryout branch 3 times, most recently from 72aca12 to cdb9705 Compare February 28, 2017 04:34
endpoints
}

// Adds a pair of nodes with specified names into the nework. Returns the endpoints of the nodes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: network. (Also above.)

// Adds a pair of nodes with specified names into the nework. Returns the endpoints of the nodes.
//
// Note: it's necessary to call `poll_all` afterwards, as this function doesn't call it for the
// second added node.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd find this more consistent if it called it for both. You could add a tunnel: bool option to the method to block the connection before calling poll_and_resend the second time?


#[test]
fn tunnel_clients() {
let min_section_size = 5;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could even use size 3, to speed up the test?

Copy link
Contributor

@dhardy dhardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor stuff, and one bug (I think)

.collect();
section_indexes.iter()
.take(section_indexes.len() - min_section_size + 1)
.foreach(|index| { let _ = nodes.remove(*index); });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd best sort the indices from highest to lowest if you want to remove them from the Vec like this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was taken in a reversed order, https://github.com/maidsafe/routing/pull/1355/files#diff-b83639c52df93eae4d3e66ec59a8e66fR69
so I think we are ok here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so. I don't much like this style of coding because it's easy to accidentally break it, but I guess it'll do.

poll_and_resend(nodes, &mut []);
}

// Adds a pair of nodes with specified names into the network. Returns the endpoints of the nodes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also blocks direct connection between these two nodes if is_tunnel is set.

mut prefix_lengths: Vec<usize>,
use_cache: bool)
-> Nodes {
pub fn create_connected_nodes_until_split_with_nodes(network: &Network,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be add_connected_nodes_until_split.

@maqi maqi force-pushed the tunnel_test_tryout branch 2 times, most recently from 61b29e0 to 7d7f674 Compare February 28, 2017 13:12
@Viv-Rajkumar Viv-Rajkumar merged commit 73b6af4 into maidsafe:master Feb 28, 2017
@maqi maqi deleted the tunnel_test_tryout branch March 11, 2017 14:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants