adafruit / Adafruit_MQTT_Library

Arduino library for MQTT support
MIT License
571 stars 291 forks source link

Fix subscription packet callbacks not executing within processPacketsUntil() #215

Closed brentru closed 1 year ago

brentru commented 1 year ago

Callback functions within subscription packets are currently not processed if processPacketsUntil() receives a subscription packet. While processPacketsUntil() does call handleSubscriptionPacket(), handleSubscriptionPacket() fills the Adafruit_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 https://github.com/adafruit/Adafruit_MQTT_Library/pull/195).

This causes any subscription packet picked up during processPacketsUntil()'s period (called by a ping() or publish()) to never execute its callback method.

This pull request:

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