Skip to content
This repository was archived by the owner on Jan 6, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion docs/group_message_delivery.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Final Stage of Group Message Delivery
# Group Message Delivery

### Introduction

Expand All @@ -18,6 +18,8 @@ The new approach will avoid the notion of a group leader. In essence, all nodes

### Implementation

Every node will follow the below procedure for all group messages. It should usually result in a group message being sent via single nodes for the first few hops, but as it gets close to the destination it will spread out in parallel to nodes close to the target.

For a node with ID `X` which has received a group message destined for address `A`, the protocol is:

- [`nth_element`](http://en.cppreference.com/w/cpp/algorithm/nth_element) sort the routing table by closesness to `X` where n<sup>th</sup> element index is 15
Expand Down
25 changes: 9 additions & 16 deletions src/maidsafe/routing/tests/network_utils_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ TEST(NetworkTest, BEH_ProcessSendUnavailableDirectEndpoint) {
NodeId(NodeId::IdType::kRandomId));
}

TEST(NetworkTest, DISABLED_FUNC_ProcessSendDirectEndpoint) {
TEST(NetworkTest, FUNC_ProcessSendDirectEndpoint) {
const int kMessageCount(10);
rudp::ManagedConnections rudp1, rudp2;
Endpoint endpoint1(GetLocalIp(), maidsafe::test::GetRandomPort());
Expand Down Expand Up @@ -154,10 +154,14 @@ TEST(NetworkTest, DISABLED_FUNC_ProcessSendDirectEndpoint) {
};

auto pmid1(passport::CreatePmidAndSigner().first);
NodeId node_id1(pmid1.name()->string());
auto pmid2(passport::CreatePmidAndSigner().first);
NodeId node_id1(pmid1.name()->string()), node_id2(pmid2.name()->string());
auto private_key1(std::make_shared<asymm::PrivateKey>(pmid1.private_key()));
auto public_key1(std::make_shared<asymm::PublicKey>(pmid1.public_key()));
auto private_key2(std::make_shared<asymm::PrivateKey>(pmid2.private_key()));
auto public_key2(std::make_shared<asymm::PublicKey>(pmid2.public_key()));
rudp::NatType nat_type;

auto a1 = std::async(std::launch::async, [&, this ]()->NodeId {
std::vector<Endpoint> bootstrap_endpoint(1, endpoint2);
NodeId chosen_bootstrap_peer;
Expand All @@ -168,11 +172,6 @@ TEST(NetworkTest, DISABLED_FUNC_ProcessSendDirectEndpoint) {
}
return chosen_bootstrap_peer;
});

auto pmid2(passport::CreatePmidAndSigner().first);
NodeId node_id2(pmid2.name()->string());
auto private_key2(std::make_shared<asymm::PrivateKey>(pmid2.private_key()));
auto public_key2(std::make_shared<asymm::PublicKey>(pmid2.public_key()));
auto a2 = std::async(std::launch::async, [&, this ]()->NodeId {
std::vector<Endpoint> bootstrap_endpoint(1, endpoint1);
NodeId chosen_bootstrap_peer;
Expand Down Expand Up @@ -214,10 +213,7 @@ TEST(NetworkTest, DISABLED_FUNC_ProcessSendDirectEndpoint) {
ScopedBootstrapFile bootstrap_file({endpoint2});
EXPECT_EQ(kSuccess, network.Bootstrap(message_received_functor3, connection_lost_functor));
rudp::NatType this_nat_type;
// RUDP NOTE: sleep here will let the test pass. Seems like rudp doesn't updates info about
// bootstrap node endpoints before returning from Bootstrap() and so some times this
// update happens after GetAvailableEndpoint called by test code and so it doesn't return
// kBootstrapConnectionAlreadyExists even though it has bootstrapped off the same node
// sleep here will let the test pass. the issue is discussed in tasks MAID-143 and MAID-311
// std::this_thread::sleep_for(std::chrono::milliseconds(100));
EXPECT_EQ(
rudp::kBootstrapConnectionAlreadyExists,
Expand All @@ -243,7 +239,7 @@ TEST(NetworkTest, DISABLED_FUNC_ProcessSendDirectEndpoint) {
}

// RT with only 1 active node and 7 inactive node
TEST(NetworkTest, DISABLED_FUNC_ProcessSendRecursiveSendOn) {
TEST(NetworkTest, FUNC_ProcessSendRecursiveSendOn) {
const int kMessageCount(1);
rudp::ManagedConnections rudp1, rudp2;
Endpoint endpoint1(GetLocalIp(), maidsafe::test::GetRandomPort());
Expand Down Expand Up @@ -368,10 +364,7 @@ TEST(NetworkTest, DISABLED_FUNC_ProcessSendRecursiveSendOn) {
EXPECT_EQ(kSuccess, network.Bootstrap(message_received_functor3, connection_lost_functor3));
rudp::EndpointPair endpoint_pair2, endpoint_pair3;
rudp::NatType this_nat_type;
// RUDP NOTE: sleep here will let the test pass. Seems like rudp doesn't updates info about
// bootstrap node endpoints before returning from Bootstrap() and so some times this
// update happens after GetAvailableEndpoint called by test code and so it doesn't return
// kBootstrapConnectionAlreadyExists even though it has bootstrapped off the same node
// sleep here will let the test pass. the issue is discussed in tasks MAID-143 and MAID-311
// std::this_thread::sleep_for(std::chrono::milliseconds(100));
EXPECT_EQ(rudp::kBootstrapConnectionAlreadyExists,
network.GetAvailableEndpoint(node_id2, endpoint_pair_2, endpoint_pair3, this_nat_type));
Expand Down