33 lines
525 B
C++
33 lines
525 B
C++
#pragma once
|
|
|
|
#include <atomic>
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <thread>
|
|
|
|
#include "graph_manager.h"
|
|
|
|
namespace rk3588 {
|
|
|
|
class HttpServer {
|
|
public:
|
|
HttpServer(GraphManager& gm, int port, std::string web_root);
|
|
~HttpServer();
|
|
|
|
bool Start();
|
|
void Stop();
|
|
|
|
private:
|
|
void ServerLoop();
|
|
|
|
GraphManager& gm_;
|
|
int port_ = 9000;
|
|
std::string web_root_;
|
|
|
|
std::atomic<bool> running_{false};
|
|
std::atomic<int64_t> listen_sock_{-1};
|
|
std::thread worker_;
|
|
};
|
|
|
|
} // namespace rk3588
|