Просмотр исходного кода

Status message reports about upload and download

anon 5 лет назад
Родитель
Сommit
025a2e975a
1 измененных файлов с 12 добавлено и 1 удалено
  1. 12 1
      daemon/src/Server.cpp

+ 12 - 1
daemon/src/Server.cpp

@@ -185,7 +185,18 @@ void con_handler::handle_read_command(const boost::system::error_code &err,
       answer["command"] = "status";
 
       // TODO answer a real status message
-      answer["response"] = "This is a status message :)";
+      std::string response;
+      if (this->getFile.is_open() && this->putFile.is_open()) {
+        response = "download and upload running";
+      } else if (this->putFile.is_open()) {
+        response = "upload running";
+      } else if (this->getFile.is_open()) {
+        response = "download running";
+      } else {
+        response = "ok";
+      }
+
+      answer["response"] = response;
       const std::string answerString = Json::writeString(stringBuilder, answer);
 
       // send answer