Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mosquitto-dev] Paho's MQTT Python receive using SSL problem

Hi,

My name is Olgierd Humeńczuk and I work for Xively@LogMeIn. We’ve encountered some problems while using your Paho Python implementation. The problem occurs when receiving retained messages after connecting to a broker using an SSL socket. It seems that after receiving data on the wire the SSL library keeps part of the data within its internal buffer and Paho Python does not check if this buffer is not empty. This results in a situation when the first message is received and parsed properly but the next message is kept within this SSL internal buffer. After adding the self._ssl.pending() > 0 condition to the paho’s loop function everything works as expecte.  Without this change the Paho Python client won’t receive all of the messages properly.

Do you know anything about that issue ? Perhaps we are not using your library properly?

This is how we’re using the client:

1. we set up paho by creating an instance and calling tls_set (in order to use SSL sockets)
2. we create a separate thread for executing the Paho client
3. we are calling loop( timeout=1.0 ) periodically from the worker thread to keep processing without blocking the thread


Our code and the described fix is available on github at https://github.com/xively/xiPy/pull/5/files

Best Regards
Olgierd Humeńczuk


Back to the top