From ab00cffffd24e7070ab01dc8ab93a19f343e889e Mon Sep 17 00:00:00 2001 From: taynpg Date: Tue, 17 Dec 2024 08:09:58 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=AD=A3=E5=B8=A6"?= =?UTF-8?q?=E7=9A=84=E8=B7=AF=E5=BE=84=E4=B8=8D=E8=83=BD=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E8=B7=AF=E5=BE=84=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +++++- client/client.cpp | 2 +- client/file_oper.cpp | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dcbfca0..0bcf03b 100644 --- a/README.md +++ b/README.md @@ -20,4 +20,8 @@ mark == 1 表示,服务客户端数据。 - 服务端如果最大上载速度下载速度(较慢)不一致,将导致大量数据堆积在`Server`端内存等待`Client`端缓慢处理。 -- 如果`client`端在传输数据的过程中异常关闭,`Server`端需要丢弃与该客户端相关的数据包。 \ No newline at end of file +- 如果`client`端在传输数据的过程中异常关闭,`Server`端需要丢弃与该客户端相关的数据包。 + +# 注意 + +- 如果两个`transmc`客户端在同一台机器上同时收发同一个文件将导致文件丢失损坏。 \ No newline at end of file diff --git a/client/client.cpp b/client/client.cpp index cc73231..83f8604 100644 --- a/client/client.cpp +++ b/client/client.cpp @@ -31,7 +31,7 @@ void CClient::run(const std::string& ip, const std::string& port) char line[512]{}; while (std::cin.getline(line, 512)) { std::string cmd_input(line); - if (std::strstr(line, "end")) { + if (cmd_input == "end") { break; } auto vec = COfStr::split(cmd_input, " "); diff --git a/client/file_oper.cpp b/client/file_oper.cpp index 518740a..34a86d8 100644 --- a/client/file_oper.cpp +++ b/client/file_oper.cpp @@ -19,7 +19,11 @@ std::vector CFileOpr::get_file_list(const std::string& input) } auto vec = COfStr::split(backup, "|"); for (const auto& item : vec) { - result.push_back(COfPath::to_full(item)); + std::string ret(item); + if (item.find("\"") != std::string::npos) { + ret = COfStr::replace(item, "\"", ""); + } + result.push_back(COfPath::to_full(ret)); } return result; }