sforkowany z mirror/meshtastic-firmware
Handle MQTT host string with port omitted
rodzic
3ea03dadb5
commit
035f25190b
|
@ -69,10 +69,14 @@ void MQTT::reconnect()
|
|||
|
||||
String server = String(serverAddr);
|
||||
int delimIndex = server.indexOf(':');
|
||||
String host = server.substring(0, delimIndex);
|
||||
String port = server.substring(delimIndex+1, server.length());
|
||||
|
||||
pubSub.setServer(host.c_str(), port.toInt());
|
||||
if (delimIndex > 0) {
|
||||
String host = server.substring(0, delimIndex);
|
||||
String port = server.substring(delimIndex+1, server.length());
|
||||
pubSub.setServer(host.c_str(), port.toInt());
|
||||
}
|
||||
else {
|
||||
pubSub.setServer(serverAddr, 1883);
|
||||
}
|
||||
|
||||
DEBUG_MSG("Connecting to MQTT server\n", serverAddr);
|
||||
auto myStatus = (statusTopic + owner.id);
|
||||
|
|
Ładowanie…
Reference in New Issue