genapts850: make sure we do not hang forever in a parse loop
when there are actually no airports to parse within the bounding box
This commit is contained in:
parent
abece63b5d
commit
4293c00b73
3 changed files with 21 additions and 10 deletions
|
@ -394,19 +394,21 @@ int main(int argc, char **argv)
|
|||
position = scheduler->FindAirport( start_id );
|
||||
|
||||
// add remaining airports within boundary
|
||||
scheduler->AddAirports( position, min_lat, min_lon, max_lat, max_lon );
|
||||
|
||||
if ( scheduler->AddAirports( position, min_lat, min_lon, max_lat, max_lon ) )
|
||||
{
|
||||
// parse all the airports that were found
|
||||
scheduler->Schedule( num_threads, summary_file );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// find all airports within given boundary
|
||||
scheduler->AddAirports( 0, min_lat, min_lon, max_lat, max_lon );
|
||||
|
||||
// and parser them
|
||||
if ( scheduler->AddAirports( 0, min_lat, min_lon, max_lat, max_lon ) )
|
||||
{
|
||||
// and parse them
|
||||
scheduler->Schedule( num_threads, summary_file );
|
||||
}
|
||||
}
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_INFO, "Done");
|
||||
exit(0);
|
||||
|
|
|
@ -590,7 +590,7 @@ void Scheduler::RetryAirport( AirportInfo* pai )
|
|||
retryList.push_back( *pai );
|
||||
}
|
||||
|
||||
void Scheduler::AddAirports( long start_pos, float min_lat, float min_lon, float max_lat, float max_lon )
|
||||
bool Scheduler::AddAirports( long start_pos, float min_lat, float min_lon, float max_lat, float max_lon )
|
||||
{
|
||||
char line[2048];
|
||||
char* def;
|
||||
|
@ -760,6 +760,15 @@ void Scheduler::AddAirports( long start_pos, float min_lat, float min_lon, float
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// did we add airports to the parse list?
|
||||
if ( originalList.size() )
|
||||
{
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Scheduler::Scheduler(string& cmd, string& datafile, const string& root, const string_list& elev_src)
|
||||
|
|
|
@ -176,7 +176,7 @@ public:
|
|||
|
||||
long FindAirport( string icao );
|
||||
void AddAirport( string icao );
|
||||
void AddAirports( long start_pos, float min_lat, float min_lon, float max_lat, float max_lon );
|
||||
bool AddAirports( long start_pos, float min_lat, float min_lon, float max_lat, float max_lon );
|
||||
void RetryAirport( AirportInfo* pInfo );
|
||||
|
||||
void Schedule( int num_threads, string& summaryfile );
|
||||
|
|
Loading…
Add table
Reference in a new issue