|
|
@ -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); } |
|
|
|
|
|
|
|