change:update读入文件改为输入而非默认。
This commit is contained in:
parent
17ab6e089e
commit
20580a4c91
@ -50,7 +50,7 @@ void CClient::run(const std::string& ip, const std::string& port)
|
||||
client_->async_recv();
|
||||
hearts_ = std::thread([&]() { hearts(); });
|
||||
std::thread thread([&]() { io_context_.run(); });
|
||||
logger_->warn("SupportCmd:Get|Up|Down|Cancel|Update(list.txt)");
|
||||
logger_->warn("SupportCmd:Get|Up|Down|Cancel|Update");
|
||||
char line[512]{};
|
||||
while (std::cin.getline(line, 512)) {
|
||||
|
||||
@ -73,26 +73,25 @@ void CClient::run(const std::string& ip, const std::string& port)
|
||||
continue;
|
||||
}
|
||||
auto vec = COfStr::split(cmd_input, " ");
|
||||
if (vec.size() < 2) {
|
||||
if (vec.size() == 3) {
|
||||
if (vec[0] == "Update") {
|
||||
request_update_list(vec[2], std::stoi(vec[1]));
|
||||
continue;
|
||||
}
|
||||
logger_->error("input's invalid format.");
|
||||
continue;
|
||||
} else if (vec.size() == 2) {
|
||||
if (vec[0] == "Down") {
|
||||
down_task(vec[1]);
|
||||
continue;
|
||||
}
|
||||
if (vec[0] == "Up") {
|
||||
up_task(cmd_input);
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
logger_->error("No matched cmd.");
|
||||
}
|
||||
std::string cmd = vec[0];
|
||||
std::string param = vec[1];
|
||||
|
||||
if (cmd == "Down") {
|
||||
down_task(vec[1]);
|
||||
continue;
|
||||
}
|
||||
if (cmd == "Up") {
|
||||
up_task(cmd_input);
|
||||
continue;
|
||||
}
|
||||
if (cmd == "Update") {
|
||||
request_update_list("list.txt", std::stoi(param));
|
||||
continue;
|
||||
}
|
||||
logger_->error("No matched cmd.");
|
||||
}
|
||||
client_->disconnect();
|
||||
thread.join();
|
||||
|
Loading…
x
Reference in New Issue
Block a user