Fixed precedence bug
This commit is contained in:
parent
8a29081486
commit
8b458cdad9
@ -157,18 +157,18 @@ uint16_t PubSubClient::readPacket(uint8_t* lengthLength) {
|
|||||||
for (uint16_t i = 0;i<length;i++)
|
for (uint16_t i = 0;i<length;i++)
|
||||||
{
|
{
|
||||||
digit = readByte();
|
digit = readByte();
|
||||||
if(this->stream && buffer[0]&MQTTPUBLISH)
|
if(this->stream && ((buffer[0]&0xF0) == MQTTPUBLISH))
|
||||||
this->stream->write(digit);
|
this->stream->write(digit);
|
||||||
if (len < MQTT_MAX_PACKET_SIZE) {
|
if (len < MQTT_MAX_PACKET_SIZE) {
|
||||||
buffer[len++] = digit;
|
buffer[len++] = digit;
|
||||||
} else {
|
} else {
|
||||||
len = 0; // This will cause the packet to be ignored.
|
if(!this->stream) len = 0; // This will cause the packet to be ignored.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a stream has been provided, indicate that we wrote the whole length,
|
// If a stream has been provided, indicate that we wrote the whole length,
|
||||||
// else return 0 if the length exceed the max packet size
|
// else return 0 if the length exceed the max packet size
|
||||||
return this->stream ? length : len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean PubSubClient::loop() {
|
boolean PubSubClient::loop() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user