diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-12-19 23:04:50 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-08-18 22:56:48 +0200 |
commit | cc01e19e8f3a8bbb8db7d3103fcec16854b11626 (patch) | |
tree | 187824e438b5ab49b5d58308abff57686ed0bacb /include/sibs | |
parent | 39f3e2049813d2556309b4ee2064287b5781415f (diff) |
Add option to force route data
Diffstat (limited to 'include/sibs')
-rw-r--r-- | include/sibs/BootstrapConnection.hpp | 4 | ||||
-rw-r--r-- | include/sibs/DirectConnection.hpp | 8 |
2 files changed, 9 insertions, 3 deletions
diff --git a/include/sibs/BootstrapConnection.hpp b/include/sibs/BootstrapConnection.hpp index 1c5c1a5..c63256a 100644 --- a/include/sibs/BootstrapConnection.hpp +++ b/include/sibs/BootstrapConnection.hpp @@ -42,7 +42,7 @@ namespace sibs DISABLE_COPY(BootstrapConnection) public: // Throws BootstrapConnectionException on error - static std::future<std::unique_ptr<BootstrapConnection>> connect(const Ipv4 &bootstrapAddress); + static std::future<std::unique_ptr<BootstrapConnection>> connect(const Ipv4 &bootstrapAddress, const ConnectionOptions &options = ConnectionOptions()); ~BootstrapConnection(); // If we are already listening on the key @pubsubKey then the callback function is overwritten @@ -57,7 +57,7 @@ namespace sibs std::vector<std::shared_ptr<DirectConnectionPeer>> getPeers(); private: // Throws BootstrapConnectionException on error - BootstrapConnection(const Ipv4 &bootstrapAddress); + BootstrapConnection(const Ipv4 &bootstrapAddress, const ConnectionOptions &options); ListenHandle listen(const PubsubKey &pubsubKey, BoostrapConnectionListenCallbackFunc callbackFunc, bool registerCallbackFunc); void receiveDataFromServer(std::shared_ptr<DirectConnectionPeer> peer, MessageType messageType, const void *data, const usize size); diff --git a/include/sibs/DirectConnection.hpp b/include/sibs/DirectConnection.hpp index 1ba8659..50fefb8 100644 --- a/include/sibs/DirectConnection.hpp +++ b/include/sibs/DirectConnection.hpp @@ -62,13 +62,18 @@ namespace sibs bool operator == (const DirectConnectionPeer &other) const; bool operator != (const DirectConnectionPeer &other) const; }; + + struct ConnectionOptions + { + bool useP2p = true; + }; class DirectConnections { DISABLE_COPY(DirectConnections) friend class BootstrapNode; public: - DirectConnections(u16 port = 0); + DirectConnections(u16 port = 0, const ConnectionOptions &options = ConnectionOptions()); ~DirectConnections(); // Throws ConnectionException on error @@ -103,6 +108,7 @@ namespace sibs PubSubOnRemoveDisconnectedPeerCallback removeDisconnectedPeerCallback; Ipv4Map<std::shared_future<PubSubConnectResult>> connectionResults; std::mutex connectionResultsMutex; + ConnectionOptions options; struct UPNPUrlData { |