Skip to content

payload parameter of type None replaced with zero-length string in will_set() #47

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 1 commit into from
Jul 28, 2020

Conversation

2bndy5
Copy link
Contributor

@2bndy5 2bndy5 commented Jul 23, 2020

satisfies #39 in accordance with paho_mqtt library compatibility

I tested this fix locally (on my trusty ItsyBitsy M4) without connection to a broker. The only esp32 I have lying around is a TinyPico, so properly testing this on my end might be a bit taxing for a 1-line fix. If there's an easier way to test this with a Raspberry Pi, I'd gladly dust off my old RPi.

I followed the data from the payload parameter through the code to see if this fix instigates another issue, and I found no problems. However, I'm not sure about self._sock.send(string) where self._lw_msg (instance attribute that holds the zero-length string when payload parameter is of type None) is passed as the string parameter in _send_str(). BTW, I have verified that self._lw_msg becomes b'' (empty bytearray) when calling will_set() using parameters' defaults with this fix.

TL;DR

All this to say that the success of this fix depends on the socket interface's ability to send an empty bytearray.

Copy link
Member

@brentru brentru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested the simpletest with an additional will_set (empty payload) against my local AEDES broker and it does not cause another issue. Broker successfully rx's empty LWT payload.

@brentru brentru merged commit 237373f into adafruit:master Jul 28, 2020
@2bndy5
Copy link
Contributor Author

2bndy5 commented Jul 29, 2020

Great news! Does this mean that the #39 can be closed?

adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jul 29, 2020
rtwfroody pushed a commit to rtwfroody/Adafruit_CircuitPython_MiniMQTT that referenced this pull request Sep 18, 2022
payload parameter of type `None` replaced with zero-length string in `will_set()`
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