|
@@ -191,6 +191,19 @@ void con_handler::handle_read_command(const boost::system::error_code &err,
|
|
|
boost::bind(&con_handler::handle_read_command,
|
|
|
shared_from_this(), placeholders::error,
|
|
|
placeholders::bytes_transferred));
|
|
|
+ } else if (root["command"].compare("close") == 0) {
|
|
|
+ answer["command"] = "close";
|
|
|
+ answer["response"] = "bye";
|
|
|
+ const std::string answerString = Json::writeString(stringBuilder, answer);
|
|
|
+
|
|
|
+ // send answer
|
|
|
+ sock.async_write_some(buffer(answerString, max_length),
|
|
|
+ boost::bind(&con_handler::handle_write,
|
|
|
+ shared_from_this(), placeholders::error,
|
|
|
+ placeholders::bytes_transferred));
|
|
|
+
|
|
|
+ // close connection
|
|
|
+ sock.close();
|
|
|
} else {
|
|
|
// TODO handle error
|
|
|
|