Skip to content

Commit

Permalink
Fix msgpack compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
svpcom committed Oct 1, 2024
1 parent 2a019d5 commit 5423dfa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion wfb_ng/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion wfb_ng/log_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
6 changes: 3 additions & 3 deletions wfb_ng/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ 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)))


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):
Expand All @@ -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):
Expand Down

0 comments on commit 5423dfa

Please sign in to comment.