From 9a284b846b256e01346e6bc61402da57b7e4ccf8 Mon Sep 17 00:00:00 2001 From: taynpg Date: Tue, 7 Jan 2025 12:18:30 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=AD=A3=E5=86=99?= =?UTF-8?q?=E5=85=A5=E5=A4=B1=E8=B4=A5=E5=88=A4=E6=96=AD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 2 +- client/client.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 83a4bb1..84731ed 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -20,7 +20,7 @@ ], "visualizerFile": "${workspaceRoot}/.vscode/qt5.natvis", "args": [ - "-h" + "-n", "1" ] }, "cmake.environment": { diff --git a/client/client.cpp b/client/client.cpp index 2dd74c9..89b5207 100644 --- a/client/client.cpp +++ b/client/client.cpp @@ -476,11 +476,10 @@ void CClient::handle_frame(CFrameBuffer* buf) th_down_active_ = std::thread([&]() { judget_down_active(); }); } down_->file_.write(buf->data_, buf->len_); - auto ws = down_->file_.gcount(); - if (static_cast(ws) != buf->len_) { + if (down_->file_.fail()) { logger_->warn("no matched write and data."); } - cur_down_size_ += ws; + cur_down_size_ += buf->len_; break; } case TYPE_OPEN_FILE: {