also fix unconditional startup of the daemon
{
int port = atoi(arg);
if( port > 0 ) {
- fgSetInt( string(flightgear::http::PROPERTY_ROOT).append("/listening-port").c_str(), port );
+ fgSetInt( string(flightgear::http::PROPERTY_ROOT).append("/options/listening-port").c_str(), port );
}
return FG_OPTIONS_OK;
}
FGHttpd * FGHttpd::createInstance( SGPropertyNode_ptr configNode )
{
- return configNode.valid() ? new MongooseHttpd( configNode ) : NULL;
+ // only create a server if a port has been configured
+ if( false == configNode.valid() ) return NULL;
+ string port = configNode->getStringValue( "options/listening-port", "" );
+ if( port.empty() ) return NULL;
+ return new MongooseHttpd( configNode );
}
} // namespace http