consider clients as offline after server start

This commit is contained in:
badaix 2015-09-12 19:25:20 +02:00
parent 05c8107203
commit a221e431aa
2 changed files with 1 additions and 20 deletions

View file

@ -42,12 +42,11 @@ Config::Config()
{ {
ClientInfoPtr client = make_shared<ClientInfo>(); ClientInfoPtr client = make_shared<ClientInfo>();
client->fromJson(*it); client->fromJson(*it);
client->connected = false;
clients.push_back(client); clients.push_back(client);
std::cout << "Client:\n" << std::setw(4) << client->toJson() << '\n'; std::cout << "Client:\n" << std::setw(4) << client->toJson() << '\n';
} }
} }
// fs::create_directory(filename_.parent_path());
} }
@ -62,22 +61,6 @@ void Config::save()
} }
void Config::test()
{
ifstream ifs("snapserver.json", std::ifstream::in);
json j;
ifs >> j;
std::cout << std::setw(4) << j << std::endl;
json j1 = j["Client"];
for (json::iterator it = j1.begin(); it != j1.end(); ++it)
{
ClientInfo client;
client.fromJson(*it);
std::cout << "Client:\n" << std::setw(4) << client.toJson() << '\n';
}
}
ClientInfoPtr Config::getClientInfo(const std::string& macAddress, bool add) ClientInfoPtr Config::getClientInfo(const std::string& macAddress, bool add)
{ {
if (macAddress.empty()) if (macAddress.empty())

View file

@ -128,7 +128,6 @@ public:
return instance_; return instance_;
} }
void test();
ClientInfoPtr getClientInfo(const std::string& mac, bool add = true); ClientInfoPtr getClientInfo(const std::string& mac, bool add = true);
std::vector<ClientInfoPtr> clients; std::vector<ClientInfoPtr> clients;
@ -139,7 +138,6 @@ public:
private: private:
Config(); Config();
std::string filename_; std::string filename_;
}; };