-
Notifications
You must be signed in to change notification settings - Fork 168
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
fix: convert session_present
flag to boolean to follow the declared type
#242
base: master
Are you sure you want to change the base?
Conversation
NOTE: it will break a few tests in emqx. |
@@ -2255,3 +2255,6 @@ redact_packet(#mqtt_packet{variable = #mqtt_packet_connect{} = Conn} = Packet) - | |||
Packet#mqtt_packet{variable = Conn#mqtt_packet_connect{password = <<"******">>}}; | |||
redact_packet(Packet) -> | |||
Packet. | |||
|
|||
flag_to_bool(0) -> false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, can be fixed in https://github.com/emqx/emqtt/blob/fix-session_present-type/src/emqtt_frame.erl#L218
similarly to how CONNECT packet flags are parsed to bools: https://github.com/emqx/emqtt/blob/fix-session_present-type/src/emqtt_frame.erl#L202
But it would require changing the record field, e.g:
#mqtt_packet_connack{session_present = SessionPresent,
Instead of:
#mqtt_packet_connack{ack_flags = AckFlags,
I think it is a good change but may break many places, worth it? |
No reason, besides improving consistency (other flags are converted and stored as boolean). Instead of this fix, we may change type of |
IMO, using a boolean is more semantic for this case. Maybe we could indicate this is a breaking change with a major version bump? |
No description provided.