Skip to content

Commit 76e4ca7

Browse files
AndrejMitrovicTrustHenry
authored andcommitted
Fix network discovery behavior
The network info was discarded instead of used. Fixes #647
1 parent 0e54eec commit 76e4ca7

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

source/agora/network/NetworkManager.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ public class NetworkManager
410410
try
411411
{
412412
auto net_info = node.getNetworkInfo();
413+
this.addAddresses(net_info.addresses);
413414
if (net_info.state == NetworkState.Complete)
414415
return; // done
415416

source/agora/test/NetworkDiscovery.d

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,12 @@ unittest
5555
network.start();
5656
scope(exit) network.shutdown();
5757
scope(failure) network.printLogs();
58+
network.waitForDiscovery();
5859

59-
try
60-
{
61-
network.waitForDiscovery();
62-
}
63-
catch (Throwable ex)
60+
foreach (key, node; network.nodes)
6461
{
65-
// discovery never reached
66-
return;
62+
auto addresses = node.client.getNetworkInfo().addresses.keys;
63+
assert(addresses.sort.uniq.count == 3,
64+
format("Node %s has %d peers: %s", key, addresses.length, addresses));
6765
}
68-
69-
assert(0); // should not be reached
7066
}

0 commit comments

Comments
 (0)