From: Roger A. Light Date: Tue, 13 Jan 2015 00:36:37 +0000 (+0000) Subject: [451735] Revert default protocol to v3.1. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=97c8103ac8d434fb53ff58be64cdcbd6388ef794;p=packages%2Fp%2Fpaho-mqtt.git [451735] Revert default protocol to v3.1. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=451735 Change-Id: I24a2e39c17b8b1cb52b38be53a0ef76c50a1c7eb --- diff --git a/ChangeLog.txt b/ChangeLog.txt index 462abf8..b805fb4 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -2,6 +2,10 @@ v1.1 - 2015-01-30 ================= - Add support for wildcard certificates. Closes #440547. +- Default connection behaviour has been reverted to MQTT v3.1 instead of + v3.1.1. There is as yet insufficient support for v3.1.1 to rely on, and + current v3.1 implementations do not return the correct CONNACK code to allow + detection of the fault. Closes #451735. v1.0.2 - 2014-09-13 diff --git a/src/paho/mqtt/client.py b/src/paho/mqtt/client.py index 096aec8..ffb5022 100755 --- a/src/paho/mqtt/client.py +++ b/src/paho/mqtt/client.py @@ -387,7 +387,7 @@ class Client(object): MQTT_LOG_ERR, and MQTT_LOG_DEBUG. The message itself is in buf. """ - def __init__(self, client_id="", clean_session=True, userdata=None, protocol=MQTTv311): + def __init__(self, client_id="", clean_session=True, userdata=None, protocol=MQTTv31): """client_id is the unique client id string used when connecting to the broker. If client_id is zero length or None, then one will be randomly generated. In this case, clean_session must be True. If this is not the @@ -408,7 +408,7 @@ class Client(object): The protocol argument allows explicit setting of the MQTT version to use for this client. Can be paho.mqtt.client.MQTTv311 (v3.1.1) or - paho.mqtt.client.MQTTv31 (v3.1), with the default being v3.1.1. If the + paho.mqtt.client.MQTTv31 (v3.1), with the default being v3.1. If the broker reports that the client connected with an invalid protocol version, the client will automatically attempt to reconnect using v3.1 instead. diff --git a/src/paho/mqtt/publish.py b/src/paho/mqtt/publish.py index 4405680..b468dda 100644 --- a/src/paho/mqtt/publish.py +++ b/src/paho/mqtt/publish.py @@ -62,7 +62,7 @@ def _on_publish(c, userdata, mid): def multiple(msgs, hostname="localhost", port=1883, client_id="", keepalive=60, - will=None, auth=None, tls=None, protocol=mqtt.MQTTv311): + will=None, auth=None, tls=None, protocol=mqtt.MQTTv31): """Publish multiple messages to a broker, then disconnect cleanly. This function creates an MQTT client, connects to a broker and publishes a @@ -172,7 +172,7 @@ def multiple(msgs, hostname="localhost", port=1883, client_id="", keepalive=60, def single(topic, payload=None, qos=0, retain=False, hostname="localhost", port=1883, client_id="", keepalive=60, will=None, auth=None, - tls=None, protocol=mqtt.MQTTv311): + tls=None, protocol=mqtt.MQTTv31): """Publish a single message to a broker, then disconnect cleanly. This function creates an MQTT client, connects to a broker and publishes a