Made rest-engine handle multiple init without dropping resources.

This commit is contained in:
Joakim Eriksson 2015-05-12 11:11:31 +02:00 committed by Niclas Finne
parent 2351ee078a
commit 539e92c084

View file

@ -70,6 +70,15 @@ LIST(restful_periodic_services);
void
rest_init_engine(void)
{
/* avoid initializing twice */
static uint8_t initialized = 0;
if(initialized) {
PRINTF("REST engine process already running - double initialization?\n");
return;
}
initialized = 1;
list_init(restful_services);
REST.set_service_callback(rest_invoke_restful_service);