File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 52
52
MQTT_UNSUB = b"\xA2 "
53
53
MQTT_DISCONNECT = b"\xe0 \0 "
54
54
55
+ MQTT_PKT_TYPE_MASK = const (0xF0 )
56
+
55
57
# Variable CONNECT header [MQTT 3.1.2]
56
58
MQTT_HDR_CONNECT = bytearray (b"\x04 MQTT\x04 \x02 \0 \0 " )
57
59
@@ -902,7 +904,7 @@ def _wait_for_msg(self, timeout=0.1):
902
904
if res in [None , b"" , b"\x00 " ]:
903
905
# If we get here, it means that there is nothing to be received
904
906
return None
905
- if res [0 ] & 0xF0 == MQTT_PINGRESP :
907
+ if res [0 ] & MQTT_PKT_TYPE_MASK == MQTT_PINGRESP :
906
908
if self .logger is not None :
907
909
self .logger .debug ("Got PINGRESP" )
908
910
sz = self ._sock_exact_recv (1 )[0 ]
@@ -912,7 +914,7 @@ def _wait_for_msg(self, timeout=0.1):
912
914
)
913
915
return MQTT_PINGRESP
914
916
915
- if res [0 ] & 0xF0 != MQTT_PUBLISH :
917
+ if res [0 ] & MQTT_PKT_TYPE_MASK != MQTT_PUBLISH :
916
918
return res [0 ]
917
919
918
920
# Handle only the PUBLISH packet type from now on.
You can’t perform that action at this time.
0 commit comments