Skip to content

Commit e2b7fa0

Browse files
author
brentru
committed
switch to _exact_recv on subscribe() calls
1 parent cb16a27 commit e2b7fa0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

adafruit_minimqtt/adafruit_minimqtt.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,6 @@ def subscribe(self, topic, qos=0):
721721
for t, q in topics:
722722
topic_size = len(t).to_bytes(2, "big")
723723
qos_byte = q.to_bytes(1, "big")
724-
#print(packet, "\n", topic_size, "\n", t, "\n", qos_byte)
725724
packet += topic_size + t.encode() + qos_byte
726725
if self.logger:
727726
for t, q in topics:
@@ -730,9 +729,9 @@ def subscribe(self, topic, qos=0):
730729
while True:
731730
op = self._wait_for_msg()
732731
if op == 0x90:
733-
self._recv_into(buf, 4)
734-
assert buf[1] == packet[2] and buf[2] == packet[3]
735-
if buf[3] == 0x80:
732+
rc = self._sock_exact_recv(4)
733+
assert rc[1] == packet[2] and rc[2] == packet[3]
734+
if rc[3] == 0x80:
736735
raise MMQTTException("SUBACK Failure!")
737736
for t, q in topics:
738737
if self.on_subscribe is not None:

0 commit comments

Comments
 (0)