Unable to set keep alive to over 32 seconds (signed int vs unsigned long)
This commit is contained in:
parent
6f23967ee1
commit
97e9614780
@ -94,7 +94,7 @@ boolean PubSubClient::connect(char *id, char *user, char *pass, char* willTopic,
|
|||||||
lastInActivity = millis();
|
lastInActivity = millis();
|
||||||
while (!_client->available()) {
|
while (!_client->available()) {
|
||||||
unsigned long t= millis();
|
unsigned long t= millis();
|
||||||
if (t-lastInActivity > MQTT_KEEPALIVE*1000) {
|
if (t-lastInActivity > MQTT_KEEPALIVE*1000UL) {
|
||||||
_client->stop();
|
_client->stop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -146,7 +146,7 @@ uint16_t PubSubClient::readPacket() {
|
|||||||
boolean PubSubClient::loop() {
|
boolean PubSubClient::loop() {
|
||||||
if (connected()) {
|
if (connected()) {
|
||||||
unsigned long t = millis();
|
unsigned long t = millis();
|
||||||
if ((t - lastInActivity > MQTT_KEEPALIVE*1000) || (t - lastOutActivity > MQTT_KEEPALIVE*1000)) {
|
if ((t - lastInActivity > MQTT_KEEPALIVE*1000UL) || (t - lastOutActivity > MQTT_KEEPALIVE*1000UL)) {
|
||||||
if (pingOutstanding) {
|
if (pingOutstanding) {
|
||||||
_client->stop();
|
_client->stop();
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user