samples: net: mqtt_publisher: handle EAGAIN from mqtt_live()
Now that mqtt_live() can send an EAGAIN message meaning: no ping was generated, let's handle that in process_mqtt_and_sleep() by skipping the call to mqtt_input() since no data will be expected. Signed-off-by: Michael Scott <mike@foundries.io>
This commit is contained in:
parent
bab2f80fa7
commit
3e24eb8af1
1 changed files with 7 additions and 7 deletions
|
@ -382,16 +382,16 @@ static int process_mqtt_and_sleep(struct mqtt_client *client, int timeout)
|
||||||
wait(remaining);
|
wait(remaining);
|
||||||
|
|
||||||
rc = mqtt_live(client);
|
rc = mqtt_live(client);
|
||||||
if (rc != 0) {
|
if (rc != 0 && rc != -EAGAIN) {
|
||||||
PRINT_RESULT("mqtt_live", rc);
|
PRINT_RESULT("mqtt_live", rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
} else if (rc == 0) {
|
||||||
|
|
||||||
rc = mqtt_input(client);
|
rc = mqtt_input(client);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
PRINT_RESULT("mqtt_input", rc);
|
PRINT_RESULT("mqtt_input", rc);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
remaining = timeout + start_time - k_uptime_get();
|
remaining = timeout + start_time - k_uptime_get();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue