From 5423dfa6d8f72ae5f5bdeefadb321a94c0b82607 Mon Sep 17 00:00:00 2001 From: Vasily Evseenko Date: Tue, 1 Oct 2024 16:49:27 +0300 Subject: [PATCH] Fix msgpack compatibility issues --- wfb_ng/cli.py | 2 +- wfb_ng/log_parser.py | 2 +- wfb_ng/server.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wfb_ng/cli.py b/wfb_ng/cli.py index 7f74103c..a8a6e66b 100644 --- a/wfb_ng/cli.py +++ b/wfb_ng/cli.py @@ -129,7 +129,7 @@ class AntennaStat(Int32StringReceiver): MAX_LENGTH = 1024 * 1024 def stringReceived(self, string): - attrs = msgpack.unpackb(string, strict_map_key=False, use_list=False) + attrs = msgpack.unpackb(string, strict_map_key=False, use_list=False, raw=False) if attrs['type'] == 'rx': self.draw_rx(attrs) diff --git a/wfb_ng/log_parser.py b/wfb_ng/log_parser.py index 2dae961b..8c636201 100644 --- a/wfb_ng/log_parser.py +++ b/wfb_ng/log_parser.py @@ -24,7 +24,7 @@ def main(): if len(data) < data_len: break - msg = msgpack.unpackb(data, strict_map_key=False, use_list=False) + msg = msgpack.unpackb(data, strict_map_key=False, use_list=False, raw=False) ts = msg.pop('timestamp') mtype = msg.pop('type') diff --git a/wfb_ng/server.py b/wfb_ng/server.py index 0439dd9d..ff9b5d8d 100644 --- a/wfb_ng/server.py +++ b/wfb_ng/server.py @@ -76,7 +76,7 @@ class BinLogger(ErrorSafeLogFile): log_cls = BinLogFile def send_stats(self, data): - data = msgpack.packb(data) + data = msgpack.packb(data, use_bin_type=True) self.write(b''.join((struct.pack('!I', len(data)), data))) @@ -84,7 +84,7 @@ class StatisticsProtocol(Int32StringReceiver): MAX_LENGTH = 1024 * 1024 def connectionMade(self): - self.sendString(msgpack.packb(dict(type='cli_title', cli_title=self.factory.cli_title))) + self.sendString(msgpack.packb(dict(type='cli_title', cli_title=self.factory.cli_title), use_bin_type=True)) self.factory.ui_sessions.append(self) def stringReceived(self, string): @@ -94,7 +94,7 @@ def connectionLost(self, reason): self.factory.ui_sessions.remove(self) def send_stats(self, data): - self.sendString(msgpack.packb(data)) + self.sendString(msgpack.packb(data, use_bin_type=True)) class StatsAndSelectorFactory(Factory):