Kagome
Polkadot Runtime Engine in C++17
http_listener_impl.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_API_TRANSPORT_IMPL_LISTENER_IMPL_HPP
7 #define KAGOME_CORE_API_TRANSPORT_IMPL_LISTENER_IMPL_HPP
8 
10 
12 #include "log/logger.hpp"
13 
14 namespace kagome::application {
15  class AppStateManager;
16 }
17 
18 namespace kagome::api {
24  : public Listener,
25  public std::enable_shared_from_this<HttpListenerImpl> {
26  public:
28 
30  const std::shared_ptr<application::AppStateManager> &app_state_manager,
31  std::shared_ptr<Context> context,
32  Configuration listener_config,
33  SessionImpl::Configuration session_config);
34 
35  ~HttpListenerImpl() override = default;
36 
38  bool prepare() override;
39 
41  bool start() override;
42 
44  void stop() override;
45 
46  void setHandlerForNewSession(NewSessionHandler &&on_new_session) override;
47 
48  private:
49  void acceptOnce() override;
50 
51  std::shared_ptr<Context> context_;
54 
55  std::unique_ptr<Acceptor> acceptor_;
56  std::unique_ptr<NewSessionHandler> on_new_session_;
57 
58  std::shared_ptr<SessionImpl> new_session_;
59 
61  };
62 } // namespace kagome::api
63 
64 #endif // KAGOME_CORE_API_TRANSPORT_IMPL_LISTENER_IMPL_HPP
std::shared_ptr< Context > context_
std::shared_ptr< SessionImpl > new_session_
server which listens for incoming connection, accepts connections making session from socket ...
Definition: listener.hpp:21
server which listens for incoming connection, accepts connections making session from socket ...
std::shared_ptr< soralog::Logger > Logger
Definition: logger.hpp:23
HTTP session for api service.
std::unique_ptr< NewSessionHandler > on_new_session_
std::unique_ptr< Acceptor > acceptor_
const SessionImpl::Configuration session_config_