From 913e410dd0066bed15bb09500a666420ad4f4b90 Mon Sep 17 00:00:00 2001 From: Qi Ma Date: Wed, 24 Sep 2014 16:15:04 +0100 Subject: [PATCH 1/4] enable disabled ProcessSend tests --- src/maidsafe/routing/tests/network_utils_test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/maidsafe/routing/tests/network_utils_test.cc b/src/maidsafe/routing/tests/network_utils_test.cc index c2ffe973..dad6f42d 100644 --- a/src/maidsafe/routing/tests/network_utils_test.cc +++ b/src/maidsafe/routing/tests/network_utils_test.cc @@ -92,7 +92,7 @@ TEST(NetworkUtilsTest, BEH_ProcessSendUnavailableDirectEndpoint) { NodeId(NodeId::IdType::kRandomId)); } -TEST(NetworkUtilsTest, DISABLED_FUNC_ProcessSendDirectEndpoint) { +TEST(NetworkUtilsTest, FUNC_ProcessSendDirectEndpoint) { const int kMessageCount(10); rudp::ManagedConnections rudp1, rudp2; Endpoint endpoint1(GetLocalIp(), maidsafe::test::GetRandomPort()); @@ -236,7 +236,7 @@ TEST(NetworkUtilsTest, DISABLED_FUNC_ProcessSendDirectEndpoint) { } // RT with only 1 active node and 7 inactive node -TEST(NetworkUtilsTest, DISABLED_FUNC_ProcessSendRecursiveSendOn) { +TEST(NetworkUtilsTest, FUNC_ProcessSendRecursiveSendOn) { const int kMessageCount(1); rudp::ManagedConnections rudp1, rudp2; Endpoint endpoint1(GetLocalIp(), maidsafe::test::GetRandomPort()); From c2fe6bf005bd8b97ab11102745eba645a8d518df Mon Sep 17 00:00:00 2001 From: Qi Ma Date: Thu, 2 Oct 2014 14:04:57 +0100 Subject: [PATCH 2/4] ensure bootstrap peer launch into std::async at the same time; sleep before check allowing record to be updated --- src/maidsafe/routing/tests/network_utils_test.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/maidsafe/routing/tests/network_utils_test.cc b/src/maidsafe/routing/tests/network_utils_test.cc index dad6f42d..0f6ed75d 100644 --- a/src/maidsafe/routing/tests/network_utils_test.cc +++ b/src/maidsafe/routing/tests/network_utils_test.cc @@ -149,10 +149,14 @@ TEST(NetworkUtilsTest, 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(pmid1.private_key())); auto public_key1(std::make_shared(pmid1.public_key())); + auto private_key2(std::make_shared(pmid2.private_key())); + auto public_key2(std::make_shared(pmid2.public_key())); rudp::NatType nat_type; + auto a1 = std::async(std::launch::async, [&, this ]()->NodeId { std::vector bootstrap_endpoint(1, endpoint2); NodeId chosen_bootstrap_peer; @@ -163,11 +167,6 @@ TEST(NetworkUtilsTest, FUNC_ProcessSendDirectEndpoint) { } return chosen_bootstrap_peer; }); - - auto pmid2(passport::CreatePmidAndSigner().first); - NodeId node_id2(pmid2.name()->string()); - auto private_key2(std::make_shared(pmid2.private_key())); - auto public_key2(std::make_shared(pmid2.public_key())); auto a2 = std::async(std::launch::async, [&, this ]()->NodeId { std::vector bootstrap_endpoint(1, endpoint1); NodeId chosen_bootstrap_peer; @@ -211,7 +210,7 @@ TEST(NetworkUtilsTest, FUNC_ProcessSendDirectEndpoint) { // 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 - // std::this_thread::sleep_for(std::chrono::milliseconds(100)); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); EXPECT_EQ( rudp::kBootstrapConnectionAlreadyExists, network.GetAvailableEndpoint(node_id2, endpoint_pair_2, endpoint_pair_3, this_nat_type)); @@ -363,7 +362,7 @@ TEST(NetworkUtilsTest, FUNC_ProcessSendRecursiveSendOn) { // 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 - // std::this_thread::sleep_for(std::chrono::milliseconds(100)); + 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)); EXPECT_EQ(rudp::kBootstrapConnectionAlreadyExists, From 9aecd42ab0968fe8821f8fcafe0f7807cb9fec43 Mon Sep 17 00:00:00 2001 From: Qi Ma Date: Tue, 7 Oct 2014 13:19:38 +0100 Subject: [PATCH 3/4] revert the sleep --- src/maidsafe/routing/tests/network_utils_test.cc | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/maidsafe/routing/tests/network_utils_test.cc b/src/maidsafe/routing/tests/network_utils_test.cc index 0f6ed75d..cf97fce2 100644 --- a/src/maidsafe/routing/tests/network_utils_test.cc +++ b/src/maidsafe/routing/tests/network_utils_test.cc @@ -206,11 +206,8 @@ TEST(NetworkUtilsTest, 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 - std::this_thread::sleep_for(std::chrono::milliseconds(100)); + // 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_pair_3, this_nat_type)); @@ -358,11 +355,8 @@ TEST(NetworkUtilsTest, 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 - std::this_thread::sleep_for(std::chrono::milliseconds(100)); + // 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)); EXPECT_EQ(rudp::kBootstrapConnectionAlreadyExists, From 6246e91299fb8247a753c25bf09913a2d4ab68cf Mon Sep 17 00:00:00 2001 From: Fraser Hutchison Date: Fri, 10 Oct 2014 09:56:16 +0100 Subject: [PATCH 4/4] Update group_message_delivery.md --- docs/group_message_delivery.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/group_message_delivery.md b/docs/group_message_delivery.md index 857ff480..dd4ac859 100644 --- a/docs/group_message_delivery.md +++ b/docs/group_message_delivery.md @@ -1,4 +1,4 @@ -# Final Stage of Group Message Delivery +# Group Message Delivery ### Introduction @@ -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 nth element index is 15