mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #53242 from s0undt3ch/hotfix/msgpack-ipc-2019.2.1
[2019.2.1] newer msgpack ipc fixes
This commit is contained in:
commit
ce5d79adce
1 changed files with 18 additions and 8 deletions
|
@ -164,11 +164,16 @@ class IPCServer(object):
|
|||
return return_message
|
||||
else:
|
||||
return _null
|
||||
if six.PY2:
|
||||
encoding = None
|
||||
# msgpack deprecated `encoding` starting with version 0.5.2
|
||||
if msgpack.version >= (0, 5, 2):
|
||||
# Under Py2 we still want raw to be set to True
|
||||
msgpack_kwargs = {'raw': six.PY2}
|
||||
else:
|
||||
encoding = 'utf-8'
|
||||
unpacker = msgpack.Unpacker(encoding=encoding)
|
||||
if six.PY2:
|
||||
msgpack_kwargs = {'encoding': None}
|
||||
else:
|
||||
msgpack_kwargs = {'encoding': 'utf-8'}
|
||||
unpacker = msgpack.Unpacker(**msgpack_kwargs)
|
||||
while not stream.closed():
|
||||
try:
|
||||
wire_bytes = yield stream.read_bytes(4096, partial=True)
|
||||
|
@ -254,11 +259,16 @@ class IPCClient(object):
|
|||
self.socket_path = socket_path
|
||||
self._closing = False
|
||||
self.stream = None
|
||||
if six.PY2:
|
||||
encoding = None
|
||||
# msgpack deprecated `encoding` starting with version 0.5.2
|
||||
if msgpack.version >= (0, 5, 2):
|
||||
# Under Py2 we still want raw to be set to True
|
||||
msgpack_kwargs = {'raw': six.PY2}
|
||||
else:
|
||||
encoding = 'utf-8'
|
||||
self.unpacker = msgpack.Unpacker(encoding=encoding)
|
||||
if six.PY2:
|
||||
msgpack_kwargs = {'encoding': None}
|
||||
else:
|
||||
msgpack_kwargs = {'encoding': 'utf-8'}
|
||||
self.unpacker = msgpack.Unpacker(**msgpack_kwargs)
|
||||
|
||||
def connected(self):
|
||||
return self.stream is not None and not self.stream.closed()
|
||||
|
|
Loading…
Add table
Reference in a new issue