add: mqtt host config option

This commit is contained in:
Tobias Reisinger 2020-07-14 20:43:58 +02:00
parent b2ac46c0fd
commit eefe50b3cd
5 changed files with 12 additions and 8 deletions

View file

@ -10,7 +10,7 @@ struct mg_connection *global_connection_mqtt;
struct mg_connection*
connection_discovery_bind(struct mg_mgr *mgr)
{
char address[100];
char address[32];
sprintf(address, "udp://0.0.0.0:%u", global_controller->discovery_port);
struct mg_connection *c = mg_bind(mgr, address, handler_discovery);
return c;
@ -19,7 +19,7 @@ connection_discovery_bind(struct mg_mgr *mgr)
struct mg_connection*
connection_command_bind(struct mg_mgr *mgr)
{
char address[100];
char address[32];
sprintf(address, "tcp://0.0.0.0:%u", global_controller->command_port);
struct mg_connection *c = mg_bind(mgr, address, handler_command);
return c;
@ -28,8 +28,8 @@ connection_command_bind(struct mg_mgr *mgr)
struct mg_connection*
connection_mqtt_connect(struct mg_mgr *mgr)
{
char address[100];
sprintf(address, "tcp://127.0.0.1:%u", global_config.mqtt_port);
char address[512];
sprintf(address, "tcp://%s:%u", global_config.mqtt_host, global_config.mqtt_port);
struct mg_connection *c = mg_connect(mgr, address, handler_mqtt);
return c;
}