|
@@ -65,7 +65,7 @@ void con_handler::handle_read_version(const boost::system::error_code &err,
|
|
|
answer["version"] = this->protocolVersion;
|
|
|
|
|
|
// check version string
|
|
|
- if (root["version"].compare(this->protocolVersion) == 0) {
|
|
|
+ if (root["version"].asString().compare(this->protocolVersion) == 0) {
|
|
|
answer["accept"] = true;
|
|
|
const std::string answerString = Json::writeString(stringBuilder, answer);
|
|
|
|
|
@@ -120,8 +120,8 @@ void con_handler::handle_read_login(const boost::system::error_code &err,
|
|
|
|
|
|
// user credentials
|
|
|
// TODO check user credentials!!!
|
|
|
- if (root["user"].compare("user") == 0 &&
|
|
|
- root["pass"].compare("pass") == 0) {
|
|
|
+ if (root["user"].asString().compare("user") == 0 &&
|
|
|
+ root["pass"].asString().compare("pass") == 0) {
|
|
|
answer["accept"] = true;
|
|
|
const std::string answerString = Json::writeString(stringBuilder, answer);
|
|
|
|
|
@@ -175,7 +175,7 @@ void con_handler::handle_read_command(const boost::system::error_code &err,
|
|
|
Json::StreamWriterBuilder stringBuilder;
|
|
|
|
|
|
// check command
|
|
|
- if (root["command"].compare("status") == 0) {
|
|
|
+ if (root["command"].asString().compare("status") == 0) {
|
|
|
// read next data
|
|
|
sock.async_read_some(buffer(data, max_length),
|
|
|
boost::bind(&con_handler::handle_read_command,
|
|
@@ -204,7 +204,7 @@ void con_handler::handle_read_command(const boost::system::error_code &err,
|
|
|
boost::bind(&con_handler::handle_write,
|
|
|
shared_from_this(), placeholders::error,
|
|
|
placeholders::bytes_transferred));
|
|
|
- } else if (root["command"].compare("list") == 0) {
|
|
|
+ } else if (root["command"].asString().compare("list") == 0) {
|
|
|
// read next data
|
|
|
sock.async_read_some(buffer(data, max_length),
|
|
|
boost::bind(&con_handler::handle_read_command,
|
|
@@ -228,7 +228,7 @@ void con_handler::handle_read_command(const boost::system::error_code &err,
|
|
|
shared_from_this(), placeholders::error,
|
|
|
placeholders::bytes_transferred));
|
|
|
|
|
|
- } else if (root["command"].compare("put") == 0) {
|
|
|
+ } else if (root["command"].asString().compare("put") == 0) {
|
|
|
// read next data
|
|
|
sock.async_read_some(buffer(data, max_length),
|
|
|
boost::bind(&con_handler::handle_read_command,
|
|
@@ -309,7 +309,7 @@ void con_handler::handle_read_command(const boost::system::error_code &err,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- } else if (root["command"].compare("get") == 0) {
|
|
|
+ } else if (root["command"].asString().compare("get") == 0) {
|
|
|
// read next data
|
|
|
sock.async_read_some(buffer(data, max_length),
|
|
|
boost::bind(&con_handler::handle_read_command,
|
|
@@ -412,7 +412,7 @@ void con_handler::handle_read_command(const boost::system::error_code &err,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- } else if (root["command"].compare("close") == 0) {
|
|
|
+ } else if (root["command"].asString().compare("close") == 0) {
|
|
|
answer["command"] = "close";
|
|
|
answer["response"] = "bye";
|
|
|
const std::string answerString = Json::writeString(stringBuilder, answer);
|