add:1.非正常状态时继续操作会自动退出。2.命令现在不区分首字母大写。
This commit is contained in:
parent
1e62a52ef7
commit
806485dc90
@ -71,23 +71,27 @@ void CClient::run(const std::string& ip, const std::string& port)
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
char* readline = fc_readline();
|
char* readline = fc_readline();
|
||||||
if (!th_run_) {
|
if (readline == nullptr) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!th_run_ || !client_->is_normal()) {
|
||||||
|
logger_->warn("The link has been closed and cannot be continued. It will automatically exit.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
std::string cmd_input(readline);
|
std::string cmd_input(readline);
|
||||||
fc_free(readline);
|
fc_free(readline);
|
||||||
std::cout << "" << std::endl;
|
std::cout << "" << std::endl;
|
||||||
cmd_input = ofen::COfStr::trim(cmd_input);
|
cmd_input = ofen::COfStr::trim(cmd_input);
|
||||||
if (cmd_input == "end") {
|
if (cmd_input == "end" || cmd_input == "End") {
|
||||||
th_run_ = false;
|
th_run_ = false;
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (cmd_input == "Get") {
|
if (cmd_input == "Get" || cmd_input == "get") {
|
||||||
get_task_list();
|
get_task_list();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (cmd_input == "Cancel") {
|
if (cmd_input == "Cancel" || cmd_input == "cancel") {
|
||||||
cancel_task();
|
cancel_task();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -100,15 +104,15 @@ void CClient::run(const std::string& ip, const std::string& port)
|
|||||||
std::string scmd = param.substr(0, param.find_first_of(" "));
|
std::string scmd = param.substr(0, param.find_first_of(" "));
|
||||||
param.erase(0, param.find_first_of(" ") + 1);
|
param.erase(0, param.find_first_of(" ") + 1);
|
||||||
|
|
||||||
if (scmd == "Update") {
|
if (scmd == "Update" || scmd == "update") {
|
||||||
request_update_list(param);
|
request_update_list(param);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (scmd == "Down") {
|
if (scmd == "Down" || scmd == "down") {
|
||||||
down_task(param);
|
down_task(param);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (scmd == "Up") {
|
if (scmd == "Up" || scmd == "up") {
|
||||||
up_task(param);
|
up_task(param);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 51baea993f2d77f5973d1c57f05557c6bbd71695
|
Subproject commit 569ba7232d12573bff572d71043a5fd0e03f9df0
|
@ -90,3 +90,8 @@ void CTcpClient::async_recv()
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CTcpClient::is_normal()
|
||||||
|
{
|
||||||
|
return is_normal_;
|
||||||
|
}
|
||||||
|
@ -18,6 +18,7 @@ public:
|
|||||||
bool send(const char* data, int len);
|
bool send(const char* data, int len);
|
||||||
void register_func(ExFun_t&& f);
|
void register_func(ExFun_t&& f);
|
||||||
void async_recv();
|
void async_recv();
|
||||||
|
bool is_normal();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<spdlog::logger> logger_;
|
std::shared_ptr<spdlog::logger> logger_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user