diff --git a/client/client.cpp b/client/client.cpp index 20cdf53..ec3fa39 100644 --- a/client/client.cpp +++ b/client/client.cpp @@ -363,11 +363,7 @@ void CClient::handle_frame(CFrameBuffer* buf) } case TYPE_TRANS_DONE: { logger_->warn("Trans done, close file {}.", down_->cur_file_); - if (down_->file_) { - fclose(down_->file_); - down_->file_ = nullptr; - } - down_->trans_state_ = TRANS_DONE; + report_trans_ret(TRANS_DONE); break; } case TYPE_OFFLINE: { @@ -381,7 +377,7 @@ void CClient::handle_frame(CFrameBuffer* buf) t->trans_state_ = TRANS_BREAK; break; } - if (!down_->cur_remote_file_.empty()) { + if (downloading_ && !down_->cur_remote_file_.empty()) { logger_->warn("Stop Down {} From {}.", down_->cur_remote_file_, buf->fid_); } report_trans_ret(TRANS_FAILED);