diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 44e1f87..1be1123 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -9,4 +9,7 @@ if (MSVC) endif() add_executable(transmc main.cpp client.h client.cpp file_oper.h file_oper.cpp) -target_link_libraries(transmc PRIVATE trans_net trans_util) \ No newline at end of file +target_link_libraries(transmc PRIVATE trans_net trans_util) +if (UNIX) +target_link_libraries(transmc PRIVATE pthread) +endif() \ No newline at end of file diff --git a/client/client.cpp b/client/client.cpp index c3411f6..2d7f151 100644 --- a/client/client.cpp +++ b/client/client.cpp @@ -89,7 +89,6 @@ bool CClient::down_task(const std::string& param) // 开始传输文件 for (const auto& item : vec) { - logger_->warn("Start Down => {}", item); down_one_file(task_list_[id]->id, item); } return true; @@ -130,8 +129,9 @@ bool CClient::down_one_file(const std::string& id, const std::string& file) down_->cur_remote_id_ = id; down_->cur_remote_file_ = file; - fs::path remote_file(down_->cur_remote_file_); + fs::path remote_file(ofen::COfPath::normalize(down_->cur_remote_file_)); down_->cur_file_ = COfPath::to_full(remote_file.filename().string()); + logger_->warn("Start Down => {} To {}", file, down_->cur_file_); // 请求下载文件 std::shared_ptr buf = std::make_shared(); @@ -155,6 +155,7 @@ void CClient::cancel_trans_file(const std::string& key) if (key.empty()) { t = down_; } else { + std::lock_guard lock(mutex_); if (up_.count(key)) { t = up_[key]; } diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index b3689b3..2a72936 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -8,4 +8,7 @@ if (MSVC) endif() add_executable(transms main.cpp server.h server.cpp) -target_link_libraries(transms PRIVATE trans_net trans_util) \ No newline at end of file +target_link_libraries(transms PRIVATE trans_net trans_util) +if (UNIX) +target_link_libraries(transms PRIVATE pthread) +endif() \ No newline at end of file