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 diff --git a/src/maidsafe/routing/tests/network_utils_test.cc b/src/maidsafe/routing/tests/network_utils_test.cc index 9b693eaa..7a346d82 100644 --- a/src/maidsafe/routing/tests/network_utils_test.cc +++ b/src/maidsafe/routing/tests/network_utils_test.cc @@ -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()); @@ -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(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; @@ -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(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; @@ -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, @@ -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()); @@ -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));