fix store file name conflict
This commit is contained in:
parent
e3b7bddf05
commit
f1c989ad36
@ -62,5 +62,5 @@ public:
|
|||||||
private:
|
private:
|
||||||
std::unordered_map<string, string> data_;
|
std::unordered_map<string, string> data_;
|
||||||
mutable std::mutex mutex_;
|
mutable std::mutex mutex_;
|
||||||
string filename_ = "server_store.txt";
|
string filename_ = "store.txt";
|
||||||
};
|
};
|
||||||
|
2
main.cpp
2
main.cpp
@ -7,6 +7,8 @@ HttpServer* server = nullptr;
|
|||||||
void signal_handler(int sig) {
|
void signal_handler(int sig) {
|
||||||
if (server) {
|
if (server) {
|
||||||
std::cout << "\nShutting down server...\n";
|
std::cout << "\nShutting down server...\n";
|
||||||
|
server->store.save();
|
||||||
|
server->sessions.save();
|
||||||
server->stop();
|
server->stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,9 @@
|
|||||||
|
|
||||||
class SessionStore {
|
class SessionStore {
|
||||||
public:
|
public:
|
||||||
SessionStore() : rng_(std::random_device{}()) {}
|
SessionStore() : rng_(std::random_device{}()) {
|
||||||
|
store_.set_file("sessions.txt");
|
||||||
|
}
|
||||||
|
|
||||||
std::string create() {
|
std::string create() {
|
||||||
std::string id = generate_id();
|
std::string id = generate_id();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user