diff options
Diffstat (limited to 'include/Channel.hpp')
-rw-r--r-- | include/Channel.hpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/Channel.hpp b/include/Channel.hpp index 16c2fb3..28d174b 100644 --- a/include/Channel.hpp +++ b/include/Channel.hpp @@ -6,10 +6,13 @@ #include "Channel.hpp" #include "types.hpp" #include <vector> +#include <SFML/System/Clock.hpp> #include <odhtdb/DatabaseNode.hpp> #include <odhtdb/Signature.hpp> #include <odhtdb/Group.hpp> #include <odhtdb/Hash.hpp> +#include <odhtdb/DhtKey.hpp> +#include <future> namespace odhtdb { @@ -58,8 +61,14 @@ namespace dchat void processEvent(const sf::Event &event, Cache &cache); void draw(sf::RenderWindow &window, Cache &cache); + void update(); + // Returns 0 if we are offline + u64 getSyncedTimestampUtcCombined(); + static void setCurrent(Channel *channel); static Channel* getCurrent(); + private: + void sendPing(u32 pingCounter, u64 pingTimestamp); protected: odhtdb::Database *database; odhtdb::DatabaseNode databaseNodeInfo; @@ -70,5 +79,8 @@ namespace dchat SystemUser systemUser; std::vector<User*> users; odhtdb::Signature::MapPublicKey<OnlineUser*> publicKeyOnlineUsersMap; + dht::InfoHash pingKey; + std::future<size_t> pingListener; + sf::Clock pingTimer; }; } |