diff options
author | Roland Reichwein <mail@reichwein.it> | 2023-03-03 16:55:33 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2023-03-03 16:55:33 +0100 |
commit | 96476044387e98ee1ee7a6eb992b521bd447813c (patch) | |
tree | caffaaef53a0afeafb5b68c460b42e98e72044c4 /webchat.h | |
parent | c9fa963e71258c5adfb71cf1996cd1bcb33df0bb (diff) |
Diffstat (limited to 'webchat.h')
-rw-r--r-- | webchat.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/webchat.h b/webchat.h new file mode 100644 index 0000000..cfec920 --- /dev/null +++ b/webchat.h @@ -0,0 +1,35 @@ +#pragma once + +#include <filesystem> +#include <memory> +#include <mutex> +#include <string> + +#include <boost/asio/ip/tcp.hpp> + +#include "diff.h" +#include "config.h" +#include "connectionregistry.h" +#include "storage.h" + +class Webchat +{ +public: + Webchat(); + int run(int argc, char* argv[]); + +private: + std::unique_ptr<Config> m_config; + std::unique_ptr<Storage> m_storage; + std::mutex m_storage_mutex; + + ConnectionRegistry m_registry; + + std::unique_ptr<boost::asio::io_context> m_ioc; + std::unique_ptr<boost::asio::ip::tcp::acceptor> m_acceptor; + + void do_accept(); + void on_accept(boost::system::error_code ec, boost::asio::ip::tcp::socket socket); + void touch_all_connections(); +}; + |