From f96ed2f3195166485875e801cd0d923023a2dd4e Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 21 Oct 2018 13:49:34 +0200 Subject: Async bootstrap connect --- include/sibs/BootstrapConnection.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/sibs/BootstrapConnection.hpp b/include/sibs/BootstrapConnection.hpp index 8156bd7..790b7ee 100644 --- a/include/sibs/BootstrapConnection.hpp +++ b/include/sibs/BootstrapConnection.hpp @@ -5,6 +5,7 @@ #include "PubsubKey.hpp" #include #include +#include namespace sibs { @@ -41,7 +42,7 @@ namespace sibs DISABLE_COPY(BootstrapConnection) public: // Throws BootstrapConnectionException on error - BootstrapConnection(const Ipv4 &bootstrapAddress); + static std::future> create(const Ipv4 &bootstrapAddress); ~BootstrapConnection(); // If we are already listening on the key @pubsubKey then the callback function is overwritten @@ -55,6 +56,9 @@ namespace sibs std::vector> getPeers(); private: + // Throws BootstrapConnectionException on error + BootstrapConnection(const Ipv4 &bootstrapAddress); + ListenHandle listen(const PubsubKey &pubsubKey, BoostrapConnectionListenCallbackFunc callbackFunc, bool registerCallbackFunc); void receiveDataFromServer(std::shared_ptr peer, MessageType messageType, const void *data, const usize size); void receiveDataFromPeer(std::shared_ptr peer, MessageType messageType, const void *data, const usize size); -- cgit v1.2.3