Merging in new data structure for nodes from node-table. End result will be consolidation into NodeId, Node (id and endpoints), NodeEntry (as in table), and Peer (connected node as in host). Rename PeerInfo to PeerSessionInfo. Rename NodeInfo to PeerInfo. PeerSessionInfo which is information about the Peer connection and will be split/merged into Node and PeerInfo. Add node-table callbacks for Host to perform connect node if there are not enough nodes.

This commit is contained in:
subtly 2015-01-10 19:45:20 +01:00
parent 6418132263
commit a1c972075e
2 changed files with 8 additions and 8 deletions

View File

@ -49,14 +49,14 @@ int peerTest(int argc, char** argv)
Host ph("Test", NetworkPreferences(listenPort)); Host ph("Test", NetworkPreferences(listenPort));
if (!remoteHost.empty()) if (!remoteHost.empty())
ph.connect(NodeId(), remoteHost, remotePort); ph.addNode(NodeId(), remoteHost, remotePort, remotePort);
for (int i = 0; ; ++i) // for (int i = 0; ; ++i)
{ // {
this_thread::sleep_for(chrono::milliseconds(100)); // this_thread::sleep_for(chrono::milliseconds(100));
if (!(i % 10)) // if (!(i % 10))
ph.keepAlivePeers(); // ph.keepAlivePeers();
} // }
return 0; return 0;
} }

View File

@ -72,7 +72,7 @@ BOOST_AUTO_TEST_CASE(topic)
this_thread::sleep_for(chrono::milliseconds(500)); this_thread::sleep_for(chrono::milliseconds(500));
ph.start(); ph.start();
this_thread::sleep_for(chrono::milliseconds(500)); this_thread::sleep_for(chrono::milliseconds(500));
ph.connect(NodeId(), "127.0.0.1", 50303); ph.addNode(NodeId(), "127.0.0.1", 50303, 50303);
KeyPair us = KeyPair::create(); KeyPair us = KeyPair::create();
for (int i = 0; i < 10; ++i) for (int i = 0; i < 10; ++i)