Skip to content

Fix: Handle encoded CBOR message exceeding buffer size #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 6, 2020

Conversation

aentinger
Copy link
Contributor

Currently the payload buffer for CBOR encoded messages has a size of 256 bytes. If the encoded cbor message is exceeding this max payload size then the whole message is discarded. This PR should fix this problem by encoding properties until the payload buffer is full and encoding the remaining properties on the next run of CBOREncoder::encode.

@codecov-commenter
Copy link

codecov-commenter commented Jul 6, 2020

Codecov Report

Merging #152 into master will increase coverage by 0.15%.
The diff coverage is 96.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #152      +/-   ##
==========================================
+ Coverage   95.43%   95.59%   +0.15%     
==========================================
  Files          29       29              
  Lines         985      998      +13     
==========================================
+ Hits          940      954      +14     
+ Misses         45       44       -1     
Impacted Files Coverage Δ
src/property/Property.h 90.47% <ø> (ø)
src/property/PropertyContainer.cpp 89.28% <ø> (-1.49%) ⬇️
src/property/Property.cpp 87.20% <94.11%> (+0.46%) ⬆️
src/cbor/CBOREncoder.cpp 95.23% <95.00%> (+15.23%) ⬆️
src/property/types/CloudBool.h 100.00% <100.00%> (ø)
src/property/types/CloudColor.h 97.08% <100.00%> (+0.02%) ⬆️
src/property/types/CloudFloat.h 100.00% <100.00%> (ø)
src/property/types/CloudInt.h 100.00% <100.00%> (ø)
src/property/types/CloudLocation.h 100.00% <100.00%> (ø)
src/property/types/CloudString.h 100.00% <100.00%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54f2d7d...b4cc977. Read the comment docs.

@aentinger
Copy link
Contributor Author

@manchoz this might be for you.

@aentinger aentinger force-pushed the fix-cbor-msg-exceeds-buffer branch from 36e4bbc to 67548fe Compare July 6, 2020 09:56
…perties exceeds the capacity of the MQTT payload buffer
@aentinger aentinger force-pushed the fix-cbor-msg-exceeds-buffer branch from 67548fe to b4cc977 Compare July 6, 2020 10:10
@arduino-libraries arduino-libraries deleted a comment from github-actions bot Jul 6, 2020
@arduino-libraries arduino-libraries deleted a comment from github-actions bot Jul 6, 2020
@aentinger
Copy link
Contributor Author

Successfully tested on PROD with

  • Nano 33 IoT ✔️
  • MKR WiFi 1010 ✔️
  • MKR 1000 ✔️
  • MKR GSM 1400 ✔️
  • ESP8266 ✔️

@aentinger aentinger merged commit d589f5b into master Jul 6, 2020
@aentinger aentinger deleted the fix-cbor-msg-exceeds-buffer branch July 6, 2020 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants