aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <0xdec05eba@gmail.com>2018-10-21 13:49:34 +0200
committerdec05eba <0xdec05eba@gmail.com>2018-10-21 13:49:34 +0200
commit1e1e4e0bbb9734e902e51339ebb8c274c2082e08 (patch)
treefd8998e9800ff464df450b71057a9590ae8e8199 /include
parentf0a2053c2b44298a8cf1aacbafb29870ed521aa0 (diff)
Async bootstrap connect
Diffstat (limited to 'include')
-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);