From 7beac1bdd9556ea982e2d8279d0ae7762572ceb5 Mon Sep 17 00:00:00 2001 From: Mike <4810578+mijofa@users.noreply.github.com> Date: Mon, 23 Oct 2023 13:47:58 +1100 Subject: [PATCH] Fix connect_srv()'s arguments to include bind_port Fixes this ~3yr old bug https://github.com/eclipse/paho.mqtt.python/issues/493 --- src/paho/mqtt/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/paho/mqtt/client.py b/src/paho/mqtt/client.py index 54405a4e..5eb36967 100644 --- a/src/paho/mqtt/client.py +++ b/src/paho/mqtt/client.py @@ -913,13 +913,13 @@ def connect(self, host, port=1883, keepalive=60, bind_address="", bind_port=0, bind_address, bind_port, clean_start, properties) return self.reconnect() - def connect_srv(self, domain=None, keepalive=60, bind_address="", + def connect_srv(self, domain=None, keepalive=60, bind_address="", bind_port=0, clean_start=MQTT_CLEAN_START_FIRST_ONLY, properties=None): """Connect to a remote broker. domain is the DNS domain to search for SRV records; if None, try to determine local domain name. - keepalive, bind_address, clean_start and properties are as for connect() + keepalive, bind_address, bind_port, clean_start and properties are as for connect() """ if HAVE_DNS is False: @@ -948,7 +948,7 @@ def connect_srv(self, domain=None, keepalive=60, bind_address="", host, port, prio, weight = answer try: - return self.connect(host, port, keepalive, bind_address, clean_start, properties) + return self.connect(host, port, keepalive, bind_address, bind_port, clean_start, properties) except Exception: pass