fix:修正传输完成后,对方断开时误打印不相关信息的错误。

This commit is contained in:
taynpg 2024-12-20 08:12:55 +08:00
parent a486b31e4e
commit 32e09d00cb

View File

@ -363,11 +363,7 @@ void CClient::handle_frame(CFrameBuffer* buf)
} }
case TYPE_TRANS_DONE: { case TYPE_TRANS_DONE: {
logger_->warn("Trans done, close file {}.", down_->cur_file_); logger_->warn("Trans done, close file {}.", down_->cur_file_);
if (down_->file_) { report_trans_ret(TRANS_DONE);
fclose(down_->file_);
down_->file_ = nullptr;
}
down_->trans_state_ = TRANS_DONE;
break; break;
} }
case TYPE_OFFLINE: { case TYPE_OFFLINE: {
@ -381,7 +377,7 @@ void CClient::handle_frame(CFrameBuffer* buf)
t->trans_state_ = TRANS_BREAK; t->trans_state_ = TRANS_BREAK;
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_); logger_->warn("Stop Down {} From {}.", down_->cur_remote_file_, buf->fid_);
} }
report_trans_ret(TRANS_FAILED); report_trans_ret(TRANS_FAILED);