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 5252MQTT_UNSUB = b"\xA2 "
5353MQTT_DISCONNECT = b"\xe0 \0 "
5454
55+ MQTT_PKT_TYPE_MASK = const (0xF0 )
56+
5557# Variable CONNECT header [MQTT 3.1.2]
5658MQTT_HDR_CONNECT = bytearray (b"\x04 MQTT\x04 \x02 \0 \0 " )
5759
@@ -902,7 +904,7 @@ def _wait_for_msg(self, timeout=0.1):
902904 if res in [None , b"" , b"\x00 " ]:
903905 # If we get here, it means that there is nothing to be received
904906 return None
905- if res [0 ] & 0xF0 == MQTT_PINGRESP :
907+ if res [0 ] & MQTT_PKT_TYPE_MASK == MQTT_PINGRESP :
906908 if self .logger is not None :
907909 self .logger .debug ("Got PINGRESP" )
908910 sz = self ._sock_exact_recv (1 )[0 ]
@@ -912,7 +914,7 @@ def _wait_for_msg(self, timeout=0.1):
912914 )
913915 return MQTT_PINGRESP
914916
915- if res [0 ] & 0xF0 != MQTT_PUBLISH :
917+ if res [0 ] & MQTT_PKT_TYPE_MASK != MQTT_PUBLISH :
916918 return res [0 ]
917919
918920 # Handle only the PUBLISH packet type from now on.
You can’t perform that action at this time.
0 commit comments