mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
NodeTable constructor requires and listens to explicit IP address instead of defaulting to 0.0.0.0 (all addresses).
This commit is contained in:
parent
96a32d19d5
commit
3d98932c1e
6
net.cpp
6
net.cpp
@ -53,7 +53,7 @@ protected:
|
||||
struct TestNodeTable: public NodeTable
|
||||
{
|
||||
/// Constructor
|
||||
TestNodeTable(ba::io_service& _io, KeyPair _alias, uint16_t _port = 30300): NodeTable(_io, _alias, _port) {}
|
||||
TestNodeTable(ba::io_service& _io, KeyPair _alias, bi::address const& _addr, uint16_t _port = 30300): NodeTable(_io, _alias, _addr, _port) {}
|
||||
|
||||
static std::vector<std::pair<KeyPair,unsigned>> createTestNodes(unsigned _count)
|
||||
{
|
||||
@ -106,10 +106,10 @@ struct TestNodeTable: public NodeTable
|
||||
*/
|
||||
struct TestNodeTableHost: public TestHost
|
||||
{
|
||||
TestNodeTableHost(unsigned _count = 8): m_alias(KeyPair::create()), nodeTable(new TestNodeTable(m_io, m_alias)), testNodes(TestNodeTable::createTestNodes(_count)) {};
|
||||
TestNodeTableHost(unsigned _count = 8): m_alias(KeyPair::create()), nodeTable(new TestNodeTable(m_io, m_alias, bi::address::from_string("127.0.0.1"))), testNodes(TestNodeTable::createTestNodes(_count)) {};
|
||||
~TestNodeTableHost() { m_io.stop(); stopWorking(); }
|
||||
|
||||
void setup() { for (auto n: testNodes) nodeTables.push_back(make_shared<TestNodeTable>(m_io,n.first,n.second)); }
|
||||
void setup() { for (auto n: testNodes) nodeTables.push_back(make_shared<TestNodeTable>(m_io,n.first, bi::address::from_string("127.0.0.1"),n.second)); }
|
||||
|
||||
void pingAll() { for (auto& t: nodeTables) t->pingTestNodes(testNodes); }
|
||||
|
||||
|
6
peer.cpp
6
peer.cpp
@ -35,8 +35,8 @@ BOOST_AUTO_TEST_CASE(host)
|
||||
auto oldLogVerbosity = g_logVerbosity;
|
||||
g_logVerbosity = 10;
|
||||
|
||||
NetworkPreferences host1prefs(30301, "127.0.0.1", true, true);
|
||||
NetworkPreferences host2prefs(30302, "127.0.0.1", true, true);
|
||||
NetworkPreferences host1prefs(30301, "127.0.0.1", false, true);
|
||||
NetworkPreferences host2prefs(30302, "127.0.0.1", false, true);
|
||||
|
||||
Host host1("Test", host1prefs);
|
||||
host1.start();
|
||||
@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE(save_nodes)
|
||||
std::list<Host*> hosts;
|
||||
for (auto i:{0,1,2,3,4,5})
|
||||
{
|
||||
Host* h = new Host("Test", NetworkPreferences(30300 + i, "127.0.0.1", true, true));
|
||||
Host* h = new Host("Test", NetworkPreferences(30300 + i, "127.0.0.1", false, true));
|
||||
h->setIdealPeerCount(10);
|
||||
// starting host is required so listenport is available
|
||||
h->start();
|
||||
|
Loading…
Reference in New Issue
Block a user