add:添加在上载时不能取消任务和重新上载列表限制,添加已经在Down时不能继续Down的限制。
This commit is contained in:
parent
6816a9d6a8
commit
c176a2b182
@ -130,6 +130,17 @@ bool CClient::down_task(const std::string& param)
|
||||
|
||||
bool CClient::up_task(const std::string& cmd)
|
||||
{
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
for (const auto& item : up_) {
|
||||
if (item.second->trans_state_ == TRANS_REDAY || item.second->trans_state_ == TRANS_ING) {
|
||||
logger_->warn("Have Task Upping, Please wait!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto list = CFileOpr::get_file_list(cmd);
|
||||
std::string msg;
|
||||
for (const auto& item : list) {
|
||||
@ -164,6 +175,15 @@ bool CClient::up_task(const std::string& cmd)
|
||||
|
||||
bool CClient::cancel_task()
|
||||
{
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
for (const auto& item : up_) {
|
||||
if (item.second->trans_state_ == TRANS_REDAY || item.second->trans_state_ == TRANS_ING) {
|
||||
logger_->warn("Have Task Upping, Please wait!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::shared_ptr<CFrameBuffer> buf = std::make_shared<CFrameBuffer>();
|
||||
buf->type_ = TYPE_CANCEL_LIST;
|
||||
return send_frame(buf.get());
|
||||
@ -403,7 +423,7 @@ void CClient::send_file_data_th(const char* keys)
|
||||
logger_->error("Stop Trans {} To {} failed.", t->cur_file_, str_key);
|
||||
return;
|
||||
}
|
||||
//std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
// std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
|
||||
buf->type_ = TYPE_TRANS_DONE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user