mqtt: update compatibility with latest client
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
bd1fd63b14
commit
bfe20433f9
|
@ -54,22 +54,36 @@ class ExtPahoClient(paho_mqtt.Client):
|
||||||
if self._port <= 0:
|
if self._port <= 0:
|
||||||
raise ValueError('Invalid port number.')
|
raise ValueError('Invalid port number.')
|
||||||
|
|
||||||
self._in_packet = {
|
if hasattr(self, "_out_packet_mutex"):
|
||||||
"command": 0,
|
# Paho Mqtt Version < 1.6.x
|
||||||
"have_remaining": 0,
|
self._in_packet = {
|
||||||
"remaining_count": [],
|
"command": 0,
|
||||||
"remaining_mult": 1,
|
"have_remaining": 0,
|
||||||
"remaining_length": 0,
|
"remaining_count": [],
|
||||||
"packet": b"",
|
"remaining_mult": 1,
|
||||||
"to_process": 0,
|
"remaining_length": 0,
|
||||||
"pos": 0}
|
"packet": b"",
|
||||||
|
"to_process": 0,
|
||||||
|
"pos": 0
|
||||||
|
}
|
||||||
|
with self._out_packet_mutex:
|
||||||
|
self._out_packet = deque() # type: ignore
|
||||||
|
|
||||||
with self._out_packet_mutex:
|
with self._current_out_packet_mutex:
|
||||||
|
self._current_out_packet = None
|
||||||
|
else:
|
||||||
|
self._in_packet = {
|
||||||
|
"command": 0,
|
||||||
|
"have_remaining": 0,
|
||||||
|
"remaining_count": [],
|
||||||
|
"remaining_mult": 1,
|
||||||
|
"remaining_length": 0,
|
||||||
|
"packet": bytearray(b""),
|
||||||
|
"to_process": 0,
|
||||||
|
"pos": 0
|
||||||
|
}
|
||||||
self._out_packet = deque() # type: ignore
|
self._out_packet = deque() # type: ignore
|
||||||
|
|
||||||
with self._current_out_packet_mutex:
|
|
||||||
self._current_out_packet = None
|
|
||||||
|
|
||||||
with self._msgtime_mutex:
|
with self._msgtime_mutex:
|
||||||
self._last_msg_in = paho_mqtt.time_func()
|
self._last_msg_in = paho_mqtt.time_func()
|
||||||
self._last_msg_out = paho_mqtt.time_func()
|
self._last_msg_out = paho_mqtt.time_func()
|
||||||
|
|
Loading…
Reference in New Issue