add: pulse mode

add: editorconfig
This commit is contained in:
Tobias Reisinger 2020-06-27 18:27:49 +02:00
parent 679175f1a9
commit 0f342b4aa8
13 changed files with 151 additions and 70 deletions

View file

@ -140,15 +140,20 @@ main(int argc, const char** argv)
/******************** START MAIN LOOP ********************/
for(;;)
time_t timer = time(NULL);
for (;;)
{
mg_mgr_poll(&mgr, 1000);
if(!global_connection_mqtt)
mg_mgr_poll(&mgr, 200);
if(time(NULL) - timer >= 1)
{
LOG_DEBUG("mqtt connection is not open\n");
connection_mqtt_connect(&mgr);
if(!global_connection_mqtt)
{
connection_mqtt_connect(&mgr);
}
handler_loop(global_connection_mqtt);
timer = time(NULL);
}
handler_loop(global_connection_mqtt);
}
terminate(0);