File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 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]:
10371037 if res in [None , b"" , b"\x00 " ]:
10381038 # If we get here, it means that there is nothing to be received
10391039 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 :
10411043 self .logger .debug ("Got PINGRESP" )
10421044 sz = self ._sock_exact_recv (1 )[0 ]
10431045 if sz != 0x00 :
10441046 raise MMQTTException (f"Unexpected PINGRESP returned from broker: { sz } ." )
1045- return MQTT_PINGRESP
1047+ return pkt_type
10461048
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
10501051
10511052 # Handle only the PUBLISH packet type from now on.
10521053 sz = self ._recv_len ()
@@ -1080,7 +1081,7 @@ def _wait_for_msg(self) -> Optional[int]:
10801081 elif res [0 ] & 6 == 4 :
10811082 assert 0
10821083
1083- return res [ 0 ]
1084+ return pkt_type
10841085
10851086 def _recv_len (self ) -> int :
10861087 """Unpack MQTT message length."""
You can’t perform that action at this time.
0 commit comments