aboutsummaryrefslogtreecommitdiff
path: root/include/sibs
diff options
context:
space:
mode:
Diffstat (limited to 'include/sibs')
-rw-r--r--include/sibs/BootstrapConnection.hpp6
1 files changed, 5 insertions, 1 deletions
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 <mutex>
#include <atomic>
+#include <future>
namespace sibs
{
@@ -41,7 +42,7 @@ namespace sibs
DISABLE_COPY(BootstrapConnection)
public:
// Throws BootstrapConnectionException on error
- BootstrapConnection(const Ipv4 &bootstrapAddress);
+ static std::future<std::unique_ptr<BootstrapConnection>> 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<std::shared_ptr<DirectConnectionPeer>> getPeers();
private:
+ // Throws BootstrapConnectionException on error
+ BootstrapConnection(const Ipv4 &bootstrapAddress);
+
ListenHandle listen(const PubsubKey &pubsubKey, BoostrapConnectionListenCallbackFunc callbackFunc, bool registerCallbackFunc);
void receiveDataFromServer(std::shared_ptr<DirectConnectionPeer> peer, MessageType messageType, const void *data, const usize size);
void receiveDataFromPeer(std::shared_ptr<DirectConnectionPeer> peer, MessageType messageType, const void *data, const usize size);