mirror of
https://github.com/xcat2/confluent.git
synced 2025-02-14 09:39:51 +00:00
Add fallback for newer msgpack
Newer msgpack refuses the encoding argument, use raw=False instead. Further, newer msgpack refuses to accept int as key by default. Opt into it as the risk is hash collision due to msgpack int being used directly, and we aren't dealing with untrusted peer (we only talk to ourselves).
This commit is contained in:
parent
3798a33213
commit
36195198a6
@ -220,7 +220,10 @@ def _start_offloader():
|
||||
|
||||
|
||||
def _recv_offload():
|
||||
upacker = msgpack.Unpacker(encoding='utf8')
|
||||
try:
|
||||
upacker = msgpack.Unpacker(encoding='utf8')
|
||||
except TypeError:
|
||||
upacker = msgpack.Unpacker(raw=False, strict_map_key=False)
|
||||
instream = _offloader.stdout.fileno()
|
||||
while True:
|
||||
select.select([_offloader.stdout], [], [])
|
||||
@ -689,7 +692,10 @@ def rescan(cfg):
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) > 1 and sys.argv[1] == '-o':
|
||||
upacker = msgpack.Unpacker(encoding='utf8')
|
||||
try:
|
||||
upacker = msgpack.Unpacker(encoding='utf8')
|
||||
except TypeError:
|
||||
upacker = msgpack.Unpacker(raw=False, strict_map_key=False)
|
||||
currfl = fcntl.fcntl(sys.stdin.fileno(), fcntl.F_GETFL)
|
||||
fcntl.fcntl(sys.stdin.fileno(), fcntl.F_SETFL, currfl | os.O_NONBLOCK)
|
||||
|
||||
@ -714,4 +720,4 @@ if __name__ == '__main__':
|
||||
print("Mac to location lookup table: -------------------")
|
||||
print(repr(_macmap))
|
||||
print("switch to fdb lookup table: -------------------")
|
||||
print(repr(_macsbyswitch))
|
||||
print(repr(_macsbyswitch))
|
||||
|
Loading…
x
Reference in New Issue
Block a user