Skip to content

Commit

Permalink
Update ksMqttConnector.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
cziter15 committed Jun 19, 2024
1 parent 805c1dc commit 606a19c
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/ksf/comp/ksMqttConnector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ namespace ksf::comps

#if ESP32
netClientUq->setTimeout(KSF_MQTT_TIMEOUT_SEC);
netClientUq->setConnectionTimeout(KSF_SEC_TO_MS(KSF_MQTT_TIMEOUT_SEC))
#elif ESP8266
netClientUq->setTimeout(KSF_SEC_TO_MS(KSF_MQTT_TIMEOUT_SEC));
#else
Expand Down Expand Up @@ -191,18 +192,10 @@ namespace ksf::comps
out += PSTR("[MQTT] Connecting to MQTT broker...");
});
#endif

#if ESP32
if (IPAddress serverIP; serverIP.fromString(this->broker.c_str()))
netClientUq->connect(serverIP, portNumber, netClientUq->getTimeout());
else
netClientUq->connect(this->broker.c_str(), portNumber, netClientUq->getTimeout());
#else
if (IPAddress serverIP; serverIP.fromString(this->broker.c_str()))
netClientUq->connect(serverIP, portNumber);
else
netClientUq->connect(this->broker.c_str(), portNumber);
#endif

/* If not connected, return. */
if (!netClientUq->connected())
Expand Down

0 comments on commit 606a19c

Please sign in to comment.