You've already forked Adafruit_MQTT_Library
mirror of
https://github.com/adafruit/Adafruit_MQTT_Library.git
synced 2025-07-27 15:01:49 +03:00
Library Fixes (#127)
* Removing warnings * handle reading zero-length packets * updating travis to exclude archived libraries, addin Arduino WiFi101 lib instead * adding esp lib to travis * restrict builds to current hardware platforms * travis, esp8266: skip esp target for non-esp-based examples * adding test skips for zero, fixing fingerprint error bump library version
This commit is contained in:
@ -53,6 +53,7 @@ uint16_t Adafruit_MQTT_Client::readPacket(uint8_t *buffer, uint16_t maxlen,
|
||||
uint16_t len = 0;
|
||||
int16_t t = timeout;
|
||||
|
||||
|
||||
while (client->connected() && (timeout >= 0)) {
|
||||
//DEBUG_PRINT('.');
|
||||
while (client->available()) {
|
||||
@ -62,6 +63,11 @@ uint16_t Adafruit_MQTT_Client::readPacket(uint8_t *buffer, uint16_t maxlen,
|
||||
buffer[len] = c;
|
||||
//DEBUG_PRINTLN((uint8_t)c, HEX);
|
||||
len++;
|
||||
|
||||
if (maxlen == 0) { // handle zero-length packets
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (len == maxlen) { // we read all we want, bail
|
||||
DEBUG_PRINT(F("Read data:\t"));
|
||||
DEBUG_PRINTBUFFER(buffer, len);
|
||||
|
Reference in New Issue
Block a user