Fix subscription packet callbacks not executing within processPacketsUntil() #215
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.
Callback functions within subscription packets are currently not processed if
processPacketsUntil()
receives a subscription packet. WhileprocessPacketsUntil()
does callhandleSubscriptionPacket()
,handleSubscriptionPacket()
fills theAdafruit_Subscription
object but does not call the callbacks as mentioned in its docstring ("// Handle any data coming in for subscriptions and fires them off to the appropriate callback") nor does it mark the subscription message as "read" (implemented in #195).This causes any subscription packet picked up during
processPacketsUntil()
's period (called by aping()
orpublish()
) to never execute its callback method.This pull request:
processSubscriptionPacket
which executes a subscription packet's associated callback and marks the message as "read"processPackets
andprocessPacketsUntil
to useprocessSubscriptionPacket
This was tested against the Adafruit IO WipperSnapper library's synchronization function and was OK for: 5x servos re-syncing, 2x DS18x components syncing, 2x i2c devices + servo + 2x dsx + 1x pin component syncing
ping @ladyada for review