Some commented out functions to enable later.
The next release of OpenDHT should contain the fixes for this.
This commit is contained in:
parent
5ab7a7bb5b
commit
d706702a4e
42
src/node.cpp
42
src/node.cpp
@ -18,8 +18,11 @@
|
||||
|
||||
#include "neocomm.h"
|
||||
|
||||
#include "error.hpp"
|
||||
|
||||
#include <opendht.h>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
static dht::DhtRunner node;
|
||||
|
||||
@ -34,3 +37,42 @@ void NeoComm_deinit() {
|
||||
void NeoComm_connect(const char *address, const unsigned short port) {
|
||||
node.bootstrap(address, std::to_string(port));
|
||||
}
|
||||
|
||||
// NOTICE: When the new OpenDHT release comes out this code should work.
|
||||
// Meanwhile just keep it commented out.
|
||||
/*int NeoComm_import_nodes(const char *node_file) {
|
||||
msgpack::unpacker upak;
|
||||
{
|
||||
std::ifstream import_file(node_file, std::ios::binary bitor
|
||||
std::ios::ate);
|
||||
if(not import_file.is_open())
|
||||
{
|
||||
add_error(std::string("Failed to open file ") + node_file);
|
||||
return 0;
|
||||
}
|
||||
auto file_size = import_file.tellg();
|
||||
import_file.seekg(0, std::ios::beg);
|
||||
upak.reserve_buffer(file_size);
|
||||
import_file.read(upak.buffer(), file_size);
|
||||
upak.buffer_consumed(file_size);
|
||||
}
|
||||
|
||||
msgpack::object_handle obj_handler;
|
||||
while(upak.next(obj_handler))
|
||||
{
|
||||
auto imported_nodes =
|
||||
obj_handler.get().as<std::vector<dht::NodeExport>>();
|
||||
node.bootstrap(imported_nodes);
|
||||
}
|
||||
return 1;
|
||||
}*/
|
||||
|
||||
/*int NeoComm_export_nodes(const char *node_file) {
|
||||
std::ofstream export_file(node_file, std::ios::binary);
|
||||
if(not export_file.is_open())
|
||||
{
|
||||
add_error(std::string("Failed to open file ") + node_file);
|
||||
return 0;
|
||||
}
|
||||
msgpack::pack(export_file, node.exportNodes());
|
||||
}*/
|
||||
|
Loading…
Reference in New Issue
Block a user