Skip to content
Snippets Groups Projects

handle unconnected client cleanup, empty root config & use json::parse

2 files
+ 26
11
Compare changes
  • Side-by-side
  • Inline

Files

+ 1
2
@@ -27,8 +27,7 @@ MQTT::Configuration::Configuration()
@@ -27,8 +27,7 @@ MQTT::Configuration::Configuration()
MQTT::Configuration::Configuration(std::string filename)
MQTT::Configuration::Configuration(std::string filename)
{
{
std::ifstream infile(filename);
std::ifstream infile(filename);
json j;
json j = json::parse(infile);
infile >> j;
host = j.value("host", "127.0.0.1");
host = j.value("host", "127.0.0.1");
port = j.value("port", 1883);
port = j.value("port", 1883);
username = j.value("username", "guest");
username = j.value("username", "guest");
Loading