mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-25 17:42:48 +00:00
Handle MQTT host string with port omitted
This commit is contained in:
parent
3ea03dadb5
commit
035f25190b
@ -69,10 +69,14 @@ void MQTT::reconnect()
|
|||||||
|
|
||||||
String server = String(serverAddr);
|
String server = String(serverAddr);
|
||||||
int delimIndex = server.indexOf(':');
|
int delimIndex = server.indexOf(':');
|
||||||
String host = server.substring(0, delimIndex);
|
if (delimIndex > 0) {
|
||||||
String port = server.substring(delimIndex+1, server.length());
|
String host = server.substring(0, delimIndex);
|
||||||
|
String port = server.substring(delimIndex+1, server.length());
|
||||||
pubSub.setServer(host.c_str(), port.toInt());
|
pubSub.setServer(host.c_str(), port.toInt());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pubSub.setServer(serverAddr, 1883);
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_MSG("Connecting to MQTT server\n", serverAddr);
|
DEBUG_MSG("Connecting to MQTT server\n", serverAddr);
|
||||||
auto myStatus = (statusTopic + owner.id);
|
auto myStatus = (statusTopic + owner.id);
|
||||||
|
Loading…
Reference in New Issue
Block a user