fix store file name conflict

This commit is contained in:
Sky Johnson 2025-06-13 13:03:24 -05:00
parent e3b7bddf05
commit f1c989ad36
3 changed files with 6 additions and 2 deletions

View File

@ -62,5 +62,5 @@ public:
private:
std::unordered_map<string, string> data_;
mutable std::mutex mutex_;
string filename_ = "server_store.txt";
string filename_ = "store.txt";
};

View File

@ -7,6 +7,8 @@ HttpServer* server = nullptr;
void signal_handler(int sig) {
if (server) {
std::cout << "\nShutting down server...\n";
server->store.save();
server->sessions.save();
server->stop();
}
}

View File

@ -7,7 +7,9 @@
class SessionStore {
public:
SessionStore() : rng_(std::random_device{}()) {}
SessionStore() : rng_(std::random_device{}()) {
store_.set_file("sessions.txt");
}
std::string create() {
std::string id = generate_id();