@@ -205,7 +205,7 @@ int MqttClient::endMessage()
205
205
{
206
206
if (!_txStreamPayload) {
207
207
if (!publishHeader (_txPayloadBufferIndex) ||
208
- (clientWrite (_txPayloadBuffer, _txPayloadBufferIndex) != _txPayloadBufferIndex)) {
208
+ (clientWrite (_txPayloadBuffer, _txPayloadBufferIndex) < _txPayloadBufferIndex)) {
209
209
stop ();
210
210
211
211
return 0 ;
@@ -439,17 +439,17 @@ void MqttClient::poll()
439
439
if ((b & 0x80 ) == 0 ) { // length done
440
440
bool malformedResponse = false ;
441
441
442
- if (_rxType == MQTT_CONNACK ||
442
+ if (_rxType == MQTT_CONNACK ||
443
443
_rxType == MQTT_PUBACK ||
444
- _rxType == MQTT_PUBREC ||
444
+ _rxType == MQTT_PUBREC ||
445
445
_rxType == MQTT_PUBCOMP ||
446
446
_rxType == MQTT_UNSUBACK) {
447
447
malformedResponse = (_rxFlags != 0x00 || _rxLength != 2 );
448
448
} else if (_rxType == MQTT_PUBLISH) {
449
449
malformedResponse = ((_rxFlags & 0x06 ) == 0x06 );
450
450
} else if (_rxType == MQTT_PUBREL) {
451
451
malformedResponse = (_rxFlags != 0x02 || _rxLength != 2 );
452
- } else if (_rxType == MQTT_SUBACK) {
452
+ } else if (_rxType == MQTT_SUBACK) {
453
453
malformedResponse = (_rxFlags != 0x00 || _rxLength != 3 );
454
454
} else if (_rxType == MQTT_PINGRESP) {
455
455
malformedResponse = (_rxFlags != 0x00 || _rxLength != 0 );
@@ -522,7 +522,7 @@ void MqttClient::poll()
522
522
if (_rxMessageIndex == 2 ) {
523
523
_rxMessageTopicLength = (_rxMessageBuffer[0 ] << 8 ) | _rxMessageBuffer[1 ];
524
524
_rxLength -= 2 ;
525
-
525
+
526
526
_rxMessageTopic = " " ;
527
527
_rxMessageTopic.reserve (_rxMessageTopicLength);
528
528
@@ -705,7 +705,7 @@ int MqttClient::read(uint8_t *buf, size_t size)
705
705
706
706
if (b == -1 ) {
707
707
break ;
708
- }
708
+ }
709
709
710
710
result++;
711
711
*buf++ = b;
0 commit comments