Skip to content
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

Async MQTT: buffer some data #2181

Merged
merged 7 commits into from
Mar 20, 2020
Merged

Async MQTT: buffer some data #2181

merged 7 commits into from
Mar 20, 2020

Conversation

mcspr
Copy link
Collaborator

@mcspr mcspr commented Mar 14, 2020

fix #2166
@karmacoma92, I think this should work now.

We already buffer the data to inject '\0' at the end, but we never re-use the buffer. Instead, allocate char buf[MQTT_MAX_PACKET_SIZE] and place the data there until we got the full message. Static allocation, avoid dynamic char buf[len+1]. Default buffer size is 1024 bytes.
Also avoid using strlcpy, since we already know the length (and because of weird len+1)

@mcspr mcspr merged commit 43c2c41 into xoseperez:dev Mar 20, 2020
@mcspr mcspr deleted the mqtt/stream-buf branch March 20, 2020 18:07
mcspr added a commit that referenced this pull request Apr 24, 2023
re-apply fix from #2181
resolve #2586
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.

[DOMOTICZ] Error parsing data
1 participant