Fix infinite loop when delivering MQTT messages.
Merge pull request #153 from akalankapagoda/InfiniteLoopFix

Fix infinite loop when delivering MQTT messages.