#pragma once #include "DirectConnection.hpp" #include "IpAddress.hpp" #include "PubsubKey.hpp" #include namespace sibs { class BootstrapException : public std::runtime_error { public: BootstrapException(const std::string &errMsg) : std::runtime_error(errMsg) {} }; class BootstrapNode { DISABLE_COPY(BootstrapNode) public: // Throws SocketCreateException or BootstrapException on error BootstrapNode(const Ipv4 &address); ~BootstrapNode(); private: void acceptConnections(); void peerSubscribe(std::shared_ptr peer, const void *data, const usize size); private: DirectConnections connections; int socket; std::thread acceptConnectionsThread; PubsubKeyMap>> subscribedPeers; }; }