Conversation
All publish methods (sync/async, v4/v5) now return Result<u16, ClientError> instead of Result<(), ClientError>. For QoS 0 publishes, 0 is returned. For QoS 1/2, the assigned packet ID is returned immediately. Implementation uses a shared Arc<AtomicU16> counter between the client and MqttState. The client pre-assigns packet IDs before sending through the channel, avoiding the need for async oneshot channels (which would deadlock the sync Client). - Add pkid_counter field to MqttState, EventLoop, and AsyncClient - MqttState: remove Clone derive, implement Debug manually - EventLoop: create and expose shared pkid_counter - AsyncClient: assign pkid via atomic fetch_add before sending - Update from_senders/from_sender signatures to accept pkid_counter - Update tests for new API and pkid wrapping behavior
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All publish methods (sync/async, v4/v5) now return Result<u16, ClientError> instead of Result<(), ClientError>. For QoS 0 publishes, 0 is returned. For QoS 1/2, the assigned packet ID is returned immediately.
Implementation uses a shared Arc counter between the client and MqttState. The client pre-assigns packet IDs before sending through the channel, avoiding the need for async oneshot channels (which would deadlock the sync Client).
Type of change
Checklist:
cargo fmtCHANGELOG.mdif it's relevant to the users of the library. If it's not relevant mention why.