|
@@ -5,6 +5,9 @@
|
|
|
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
|
|
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
|
|
|
#include "boost/property_tree/ptree.hpp"
|
|
#include "boost/property_tree/ptree.hpp"
|
|
|
#include "boost/property_tree/json_parser.hpp"
|
|
#include "boost/property_tree/json_parser.hpp"
|
|
|
|
|
+#include <boost/asio.hpp>
|
|
|
|
|
+#include <boost/thread.hpp>
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// Split a hostport string like "127.0.0.1:12000" at the rightmost colon
|
|
// Split a hostport string like "127.0.0.1:12000" at the rightmost colon
|
|
|
// into a host part "127.0.0.1" and a port part "12000".
|
|
// into a host part "127.0.0.1" and a port part "12000".
|
|
@@ -116,7 +119,7 @@ bool config_parse(Config &config, const std::string configstr,
|
|
|
} else if (!nentry.first.compare("clisten")) {
|
|
} else if (!nentry.first.compare("clisten")) {
|
|
|
ret &= split_host_port(nc.clistenhost, nc.clistenport,
|
|
ret &= split_host_port(nc.clistenhost, nc.clistenport,
|
|
|
nentry.second.get_value<std::string>());
|
|
nentry.second.get_value<std::string>());
|
|
|
- } else if (!nentry.first.compare("role")) {
|
|
|
|
|
|
|
+ } else if (!nentry.first.compare("roles")) {
|
|
|
nc.roles = nentry.second.get_value<std::uint8_t>();
|
|
nc.roles = nentry.second.get_value<std::uint8_t>();
|
|
|
} else {
|
|
} else {
|
|
|
std::cerr << "Unknown field in host config: " <<
|
|
std::cerr << "Unknown field in host config: " <<
|
|
@@ -191,6 +194,29 @@ int main(int argc, char **argv)
|
|
|
printf("Number of ingestion_nodes = %ld, Number of storage_node = %ld\n",
|
|
printf("Number of ingestion_nodes = %ld, Number of storage_node = %ld\n",
|
|
|
ingestion_nodes.size(), storage_nodes.size());
|
|
ingestion_nodes.size(), storage_nodes.size());
|
|
|
|
|
|
|
|
|
|
+ // Attempt sending a data packet to one of the ingestion servers
|
|
|
|
|
+ boost::asio::io_context io_context;
|
|
|
|
|
+ boost::system::error_code err;
|
|
|
|
|
+ boost::asio::ip::tcp::socket nodesock(io_context);
|
|
|
|
|
+ boost::asio::ip::tcp::resolver resolver(io_context);
|
|
|
|
|
+
|
|
|
|
|
+ while(1) {
|
|
|
|
|
+#ifdef VERBOSE_NET
|
|
|
|
|
+ std::cerr << "Connecting to " << ingestion_nodes[0].name << "...\n";
|
|
|
|
|
+#endif
|
|
|
|
|
+ std::cout << ingestion_nodes[0].clistenhost << ":" << ingestion_nodes[0].clistenport;
|
|
|
|
|
+ boost::asio::connect(nodesock,
|
|
|
|
|
+ resolver.resolve(ingestion_nodes[0].clistenhost,
|
|
|
|
|
+ ingestion_nodes[0].clistenport), err);
|
|
|
|
|
+ if (!err) break;
|
|
|
|
|
+ std::cerr << "Connection to " << ingestion_nodes[0].name <<
|
|
|
|
|
+ " refused, will retry.\n";
|
|
|
|
|
+ sleep(1);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ nodenum_t node_num = 7;
|
|
|
|
|
+ boost::asio::write(nodesock,
|
|
|
|
|
+ boost::asio::buffer(&node_num, sizeof(node_num)));
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
Spin config.user_client actual clients. Each client:
|
|
Spin config.user_client actual clients. Each client:
|