@@ -529,14 +529,14 @@ bool AsyncMqttClient::_sendPing() {
529
529
fixedHeader[1 ] = 0 ;
530
530
531
531
size_t neededSpace = 2 ;
532
-
532
+
533
533
if (_client.space () < neededSpace) return false ;
534
534
535
535
_client.add (fixedHeader, 2 );
536
536
_client.send ();
537
537
_lastClientActivity = millis ();
538
538
_lastPingRequestTime = millis ();
539
-
539
+
540
540
return true ;
541
541
}
542
542
@@ -599,15 +599,15 @@ uint16_t AsyncMqttClient::subscribe(const char* topic, uint8_t qos) {
599
599
qosByte[0 ] = qos;
600
600
601
601
uint8_t remainingLengthLength = AsyncMqttClientInternals::Helpers::encodeRemainingLength (2 + 2 + topicLength + 1 , fixedHeader + 1 );
602
-
602
+
603
603
size_t neededSpace = 0 ;
604
604
neededSpace += 1 + remainingLengthLength;
605
605
neededSpace += 2 ;
606
606
neededSpace += 2 ;
607
607
neededSpace += topicLength;
608
608
neededSpace += 1 ;
609
609
if (_client.space () < neededSpace) return 0 ;
610
-
610
+
611
611
_client.add (fixedHeader, 1 + remainingLengthLength);
612
612
_client.add (packetIdBytes, 2 );
613
613
_client.add (topicLengthBytes, 2 );
@@ -638,14 +638,14 @@ uint16_t AsyncMqttClient::unsubscribe(const char* topic) {
638
638
topicLengthBytes[1 ] = topicLength & 0xFF ;
639
639
640
640
uint8_t remainingLengthLength = AsyncMqttClientInternals::Helpers::encodeRemainingLength (2 + 2 + topicLength, fixedHeader + 1 );
641
-
641
+
642
642
size_t neededSpace = 0 ;
643
643
neededSpace += 1 + remainingLengthLength;
644
644
neededSpace += 2 ;
645
645
neededSpace += 2 ;
646
646
neededSpace += topicLength;
647
647
if (_client.space () < neededSpace) return 0 ;
648
-
648
+
649
649
_client.add (fixedHeader, 1 + remainingLengthLength);
650
650
_client.add (packetIdBytes, 2 );
651
651
_client.add (topicLengthBytes, 2 );
@@ -695,15 +695,15 @@ uint16_t AsyncMqttClient::publish(const char* topic, uint8_t qos, bool retain, c
695
695
uint32_t remainingLength = 2 + topicLength + payloadLength;
696
696
if (qos != 0 ) remainingLength += 2 ;
697
697
uint8_t remainingLengthLength = AsyncMqttClientInternals::Helpers::encodeRemainingLength (remainingLength, fixedHeader + 1 );
698
-
698
+
699
699
size_t neededSpace = 0 ;
700
700
neededSpace += 1 + remainingLengthLength;
701
701
neededSpace += 2 ;
702
702
neededSpace += topicLength;
703
703
if (qos != 0 ) neededSpace += 2 ;
704
704
if (payload != nullptr ) neededSpace += payloadLength;
705
705
if (_client.space () < neededSpace) return 0 ;
706
-
706
+
707
707
_client.add (fixedHeader, 1 + remainingLengthLength);
708
708
_client.add (topicLengthBytes, 2 );
709
709
_client.add (topic, topicLength);
0 commit comments