Ensure that num of commands is 0 before processing tracker response

This commit is contained in:
Tatsuhiro Tsujikawa 2012-09-02 17:43:26 +09:00
parent 3c39931566
commit e2bf627b17

View File

@ -112,7 +112,12 @@ bool TrackerWatcherCommand::execute() {
A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, ex);
}
}
} else if(trackerRequestGroup_->downloadFinished()){
} else if(trackerRequestGroup_->getNumCommand() == 0 &&
trackerRequestGroup_->downloadFinished()){
// 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_);