kopia lustrzana https://github.com/micropython/micropython-lib
umqtt.simple: Simplify check for user being unused.
There don't seem to be any MQTT implementations that expect an empty username (instead of the field missing), so the check for unused `user` can be simplified. Signed-off-by: Felix Dörre <felix@dogcraft.de>pull/793/head
rodzic
7cdf708815
commit
803452a1ac
|
@ -75,7 +75,7 @@ class MQTTClient:
|
||||||
|
|
||||||
sz = 10 + 2 + len(self.client_id)
|
sz = 10 + 2 + len(self.client_id)
|
||||||
msg[6] = clean_session << 1
|
msg[6] = clean_session << 1
|
||||||
if self.user is not None:
|
if self.user:
|
||||||
sz += 2 + len(self.user) + 2 + len(self.pswd)
|
sz += 2 + len(self.user) + 2 + len(self.pswd)
|
||||||
msg[6] |= 0xC0
|
msg[6] |= 0xC0
|
||||||
if self.keepalive:
|
if self.keepalive:
|
||||||
|
@ -101,7 +101,7 @@ class MQTTClient:
|
||||||
if self.lw_topic:
|
if self.lw_topic:
|
||||||
self._send_str(self.lw_topic)
|
self._send_str(self.lw_topic)
|
||||||
self._send_str(self.lw_msg)
|
self._send_str(self.lw_msg)
|
||||||
if self.user is not None:
|
if self.user:
|
||||||
self._send_str(self.user)
|
self._send_str(self.user)
|
||||||
self._send_str(self.pswd)
|
self._send_str(self.pswd)
|
||||||
resp = self.sock.read(4)
|
resp = self.sock.read(4)
|
||||||
|
|
Ładowanie…
Reference in New Issue