Code cleanup

pull/28/head
Tatsuhiro Tsujikawa 2012-09-07 21:45:36 +09:00
parent 763c7a0aa0
commit d0703a2f26
1 changed files with 19 additions and 18 deletions

View File

@ -112,12 +112,12 @@ bool TrackerWatcherCommand::execute() {
A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, ex); A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, ex);
} }
} }
} else if(trackerRequestGroup_->getNumCommand() == 0 && } else if(trackerRequestGroup_->getNumCommand() == 0) {
trackerRequestGroup_->downloadFinished()){
// We really want to make sure that tracker request has finished // We really want to make sure that tracker request has finished
// by checking getNumCommand() == 0. Because we reset // by checking getNumCommand() == 0. Because we reset
// trackerRequestGroup_, if it is still used in other Command, we // trackerRequestGroup_, if it is still used in other Command, we
// will get Segmentation fault. // will get Segmentation fault.
if(trackerRequestGroup_->downloadFinished()) {
try { try {
std::string trackerResponse = getTrackerResponse(trackerRequestGroup_); std::string trackerResponse = getTrackerResponse(trackerRequestGroup_);
@ -132,7 +132,7 @@ bool TrackerWatcherCommand::execute() {
} }
} }
trackerRequestGroup_.reset(); trackerRequestGroup_.reset();
} else if(trackerRequestGroup_->getNumCommand() == 0){ } else {
// handle errors here // handle errors here
btAnnounce_->announceFailure(); // inside it, trackers = 0. btAnnounce_->announceFailure(); // inside it, trackers = 0.
trackerRequestGroup_.reset(); trackerRequestGroup_.reset();
@ -140,6 +140,7 @@ bool TrackerWatcherCommand::execute() {
btAnnounce_->resetAnnounce(); btAnnounce_->resetAnnounce();
} }
} }
}
e_->addCommand(this); e_->addCommand(this);
return false; return false;
} }