makePeer and support setting listen IP.

This commit is contained in:
subtly 2015-03-28 09:39:04 +01:00
parent 8df136cdeb
commit f6aaa7b12f

View File

@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(host)
auto node2 = host2.id(); auto node2 = host2.id();
host2.start(); host2.start();
host1.addNode(node2, "127.0.0.1", host2prefs.listenPort, host2prefs.listenPort); host1.addNode(node2, bi::address::from_string("127.0.0.1"), host2prefs.listenPort, host2prefs.listenPort);
this_thread::sleep_for(chrono::seconds(3)); this_thread::sleep_for(chrono::seconds(3));
@ -73,11 +73,11 @@ BOOST_AUTO_TEST_CASE(save_nodes)
Host& host = *hosts.front(); Host& host = *hosts.front();
for (auto const& h: hosts) for (auto const& h: hosts)
host.addNode(h->id(), "127.0.0.1", h->listenPort(), h->listenPort()); host.addNode(h->id(), bi::address::from_string("127.0.0.1"), h->listenPort(), h->listenPort());
Host& host2 = *hosts.back(); Host& host2 = *hosts.back();
for (auto const& h: hosts) for (auto const& h: hosts)
host2.addNode(h->id(), "127.0.0.1", h->listenPort(), h->listenPort()); host2.addNode(h->id(), bi::address::from_string("127.0.0.1"), h->listenPort(), h->listenPort());
this_thread::sleep_for(chrono::milliseconds(2000)); this_thread::sleep_for(chrono::milliseconds(2000));
bytes firstHostNetwork(host.saveNetwork()); bytes firstHostNetwork(host.saveNetwork());
@ -122,7 +122,7 @@ int peerTest(int argc, char** argv)
Host ph("Test", NetworkPreferences(listenPort)); Host ph("Test", NetworkPreferences(listenPort));
if (!remoteHost.empty() && !remoteAlias) if (!remoteHost.empty() && !remoteAlias)
ph.addNode(remoteAlias, remoteHost, remotePort, remotePort); ph.addNode(remoteAlias, bi::address::from_string(remoteHost), remotePort, remotePort);
this_thread::sleep_for(chrono::milliseconds(200)); this_thread::sleep_for(chrono::milliseconds(200));