22#include <unordered_map>
24#include <netinet/in.h>
34 std::unordered_map<std::string, mesh::NodeIdent> peers;
35 int ai_family{AF_INET};
38 std::unordered_map<std::string, int> send_sockets;
41 std::vector<std::thread> threads;
43 std::shared_ptr<p2p::Logger::p2p_log> p2p_log{
nullptr};
45 void set_sock_addr_(
const char *address_str,
int port,
struct sockaddr_in *saddr);
46 int connect_to_server_(
const std::string &ip,
int port);
50 const std::unordered_map<std::string, mesh::NodeIdent> &servers);
67 int send_buf(
const std::string &dst,
void *buf,
size_t len);
int shutdown()
close connections to all servers on all the workers.
Client(const mesh::NodeIdent &self, const std::unordered_map< std::string, mesh::NodeIdent > &servers)
int start()
Connects to all the servers on all the workers and saves the Socket ids in send_socks_ map.
int send_buf(const std::string &dst, void *buf, size_t len)
sends data to the destination.