Commit 6a0375fb authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Move the 'max_clients' value publishing to the individual servers

parent e5165e16
Pipeline #3530 passed with stage
in 5 minutes and 28 seconds
......@@ -5093,6 +5093,7 @@ void ftp_server(void* arg)
set_state(SERVER_READY);
lprintf(LOG_INFO,"FTP Server thread started");
mqtt_pub_uintval(&startup->mqtt, TOPIC_SERVER, "max_clients", startup->max_clients);
while(ftp_set!=NULL && !terminate_server) {
YIELD();
......
......@@ -6273,6 +6273,7 @@ void mail_server(void* arg)
set_state(SERVER_READY);
lprintf(LOG_INFO,"Mail Server thread started");
mqtt_pub_uintval(&startup->mqtt, TOPIC_SERVER, "max_clients", startup->max_clients);
while(!terminated && !terminate_server) {
YIELD();
......
......@@ -5229,6 +5229,7 @@ NO_SSH:
set_state(SERVER_READY);
lprintf(LOG_INFO,"Terminal Server thread started for nodes %d through %d", first_node, last_node);
mqtt_pub_uintval(&startup->mqtt, TOPIC_SERVER, "max_clients", (last_node - first_node) + 1);
while(!terminate_server) {
YIELD();
......
......@@ -1813,15 +1813,18 @@ int main(int argc, char** argv)
lprintf(LOG_ERR, "MQTT open failure: %d", result);
} else {
result = mqtt_thread_start(&bbs_startup.mqtt);
if(result != MQTT_SUCCESS)
if(result != MQTT_SUCCESS) {
lprintf(LOG_ERR, "Error %d starting pub/sub thread", result);
lprintf(LOG_INFO, "MQTT connecting to broker %s:%u", scfg.mqtt.broker_addr, scfg.mqtt.broker_port);
result = mqtt_connect(&bbs_startup.mqtt, /* bind_address: */NULL);
if(result == MQTT_SUCCESS) {
lprintf(LOG_INFO, "MQTT broker-connect (%s:%d) successful", scfg.mqtt.broker_addr, scfg.mqtt.broker_port);
} else {
lprintf(LOG_ERR, "MQTT broker-connect (%s:%d) failure: %d", scfg.mqtt.broker_addr, scfg.mqtt.broker_port, result);
mqtt_close(&bbs_startup.mqtt);
} else {
lprintf(LOG_INFO, "MQTT connecting to broker %s:%u", scfg.mqtt.broker_addr, scfg.mqtt.broker_port);
result = mqtt_connect(&bbs_startup.mqtt, /* bind_address: */NULL);
if(result == MQTT_SUCCESS) {
lprintf(LOG_INFO, "MQTT broker-connect (%s:%d) successful", scfg.mqtt.broker_addr, scfg.mqtt.broker_port);
} else {
lprintf(LOG_ERR, "MQTT broker-connect (%s:%d) failure: %d", scfg.mqtt.broker_addr, scfg.mqtt.broker_port, result);
mqtt_close(&bbs_startup.mqtt);
}
}
}
}
......@@ -1839,11 +1842,6 @@ int main(int argc, char** argv)
services_startup.mqtt = bbs_startup.mqtt;
services_startup.mqtt.server = "srvc";
mqtt[SERVER_SERVICES] = &services_startup.mqtt;
p = "max_clients";
mqtt_pub_uintval(&bbs_startup.mqtt, TOPIC_SERVER, p, (bbs_startup.last_node - bbs_startup.first_node) + 1);
mqtt_pub_uintval(&mail_startup.mqtt, TOPIC_SERVER, p, mail_startup.max_clients);
mqtt_pub_uintval(&ftp_startup.mqtt, TOPIC_SERVER, p, ftp_startup.max_clients);
mqtt_pub_uintval(&web_startup.mqtt, TOPIC_SERVER, p, web_startup.max_clients);
mqtt_pub_strval(&bbs_startup.mqtt, TOPIC_HOST, "version", sbbscon_ver());
mqtt_pub_strval(&bbs_startup.mqtt, TOPIC_HOST, "status", "initializing");
......
......@@ -7203,6 +7203,7 @@ void web_server(void* arg)
set_state(SERVER_READY);
lprintf(LOG_INFO,"Web Server thread started");
mqtt_pub_uintval(&startup->mqtt, TOPIC_SERVER, "max_clients", startup->max_clients);
while(!terminated && !terminate_server) {
YIELD();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment