mirror of https://github.com/aria2/aria2
Code cleanup
parent
763c7a0aa0
commit
d0703a2f26
|
@ -112,33 +112,34 @@ bool TrackerWatcherCommand::execute() {
|
|||
A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, ex);
|
||||
}
|
||||
}
|
||||
} else if(trackerRequestGroup_->getNumCommand() == 0 &&
|
||||
trackerRequestGroup_->downloadFinished()){
|
||||
} else if(trackerRequestGroup_->getNumCommand() == 0) {
|
||||
// We really want to make sure that tracker request has finished
|
||||
// by checking getNumCommand() == 0. Because we reset
|
||||
// trackerRequestGroup_, if it is still used in other Command, we
|
||||
// will get Segmentation fault.
|
||||
try {
|
||||
std::string trackerResponse = getTrackerResponse(trackerRequestGroup_);
|
||||
if(trackerRequestGroup_->downloadFinished()) {
|
||||
try {
|
||||
std::string trackerResponse = getTrackerResponse(trackerRequestGroup_);
|
||||
|
||||
processTrackerResponse(trackerResponse);
|
||||
btAnnounce_->announceSuccess();
|
||||
btAnnounce_->resetAnnounce();
|
||||
} catch(RecoverableException& ex) {
|
||||
A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, ex);
|
||||
btAnnounce_->announceFailure();
|
||||
processTrackerResponse(trackerResponse);
|
||||
btAnnounce_->announceSuccess();
|
||||
btAnnounce_->resetAnnounce();
|
||||
} catch(RecoverableException& ex) {
|
||||
A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, ex);
|
||||
btAnnounce_->announceFailure();
|
||||
if(btAnnounce_->isAllAnnounceFailed()) {
|
||||
btAnnounce_->resetAnnounce();
|
||||
}
|
||||
}
|
||||
trackerRequestGroup_.reset();
|
||||
} else {
|
||||
// handle errors here
|
||||
btAnnounce_->announceFailure(); // inside it, trackers = 0.
|
||||
trackerRequestGroup_.reset();
|
||||
if(btAnnounce_->isAllAnnounceFailed()) {
|
||||
btAnnounce_->resetAnnounce();
|
||||
}
|
||||
}
|
||||
trackerRequestGroup_.reset();
|
||||
} else if(trackerRequestGroup_->getNumCommand() == 0){
|
||||
// handle errors here
|
||||
btAnnounce_->announceFailure(); // inside it, trackers = 0.
|
||||
trackerRequestGroup_.reset();
|
||||
if(btAnnounce_->isAllAnnounceFailed()) {
|
||||
btAnnounce_->resetAnnounce();
|
||||
}
|
||||
}
|
||||
e_->addCommand(this);
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue