Implemented first connect function.

This commit is contained in:
Nicolás Ortega Froysa 2017-08-23 15:12:04 -05:00
parent 9d5131ca52
commit 83ed9b2a86
No known key found for this signature in database
GPG Key ID: FEC70E3BAE2E69BF

View File

@ -18,14 +18,16 @@
#include "neocomm/Node.hpp" #include "neocomm/Node.hpp"
#include <stdexcept>
neocomm::Node::Node() : status(0) { } neocomm::Node::Node() : status(0) { }
void neocomm::Node::bind(const short &port) { void neocomm::Node::bind(const short &port) {
node.run(port, dht::crypto::generateIdentity(), true, status); node.run(port, dht::crypto::generateIdentity(), true, status);
} }
void neocomm::Node::connect(const std::string &host, const short &port) {
node.bootstrap(host.c_str(), std::to_string(port).c_str());
}
neocomm::Node::~Node() { neocomm::Node::~Node() {
node.join(); node.join();
} }