File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -1037,16 +1037,17 @@ def _wait_for_msg(self) -> Optional[int]:
1037
1037
if res in [None , b"" , b"\x00 " ]:
1038
1038
# If we get here, it means that there is nothing to be received
1039
1039
return None
1040
- if res [0 ] & MQTT_PKT_TYPE_MASK == MQTT_PINGRESP :
1040
+ pkt_type = res [0 ] & MQTT_PKT_TYPE_MASK
1041
+ self .logger .debug (f"Got message type: { hex (pkt_type )} pkt: { hex (res [0 ])} " )
1042
+ if pkt_type == MQTT_PINGRESP :
1041
1043
self .logger .debug ("Got PINGRESP" )
1042
1044
sz = self ._sock_exact_recv (1 )[0 ]
1043
1045
if sz != 0x00 :
1044
1046
raise MMQTTException (f"Unexpected PINGRESP returned from broker: { sz } ." )
1045
- return MQTT_PINGRESP
1047
+ return pkt_type
1046
1048
1047
- if res [0 ] & MQTT_PKT_TYPE_MASK != MQTT_PUBLISH :
1048
- self .logger .debug (f"Got message type: { hex (res [0 ])} " )
1049
- return res [0 ]
1049
+ if pkt_type != MQTT_PUBLISH :
1050
+ return pkt_type
1050
1051
1051
1052
# Handle only the PUBLISH packet type from now on.
1052
1053
sz = self ._recv_len ()
@@ -1080,7 +1081,7 @@ def _wait_for_msg(self) -> Optional[int]:
1080
1081
elif res [0 ] & 6 == 4 :
1081
1082
assert 0
1082
1083
1083
- return res [ 0 ]
1084
+ return pkt_type
1084
1085
1085
1086
def _recv_len (self ) -> int :
1086
1087
"""Unpack MQTT message length."""
You can’t perform that action at this time.
0 commit comments