knolleary/pubsubclient — pull request #15 by arkusuma (2012-11-25 06:49:31+00:00)
Title: Process incoming packet first in loop()

Hi Nick,

I'm writing a GPRSClient. I've got a case where I can only call PubSubClient::loop() after a long operation (GPRSClient::write() with timeout of 30 seconds, way beyond MQTT_KEEPALIVE). On that period a MQTT packet came (PingResp in this case). When I finally call PubSubClient::loop() it disconnect the connection because of PingOutstanding timeout, even though the packet is there in GPRSClient RX buffer. This patch fix that problem by handling incoming packet first before checking for timeout.

Regards,
Anugrah