~mdkcore/jackplug

1c4ed4cd86acd9e47079c349011765e5ed65a95f — Rodrigo Oliveira 3 years ago 18ae853
PA-2589 - Use decode on service identifier before calling timeout and connection callbacks

This is a workaround to proper handle service identifier from
python2->python3, as bytes is the preferred data type here [1].

[1] https://pyzmq.readthedocs.io/en/latest/unicode.html#what-this-means-for-pyzmq
2 files changed, 3 insertions(+), 3 deletions(-)

M jackplug/jack.py
M jackplug/plug.py
M jackplug/jack.py => jackplug/jack.py +1 -1
@@ 42,7 42,7 @@ class JackBase(object):

        self.socket = self.context.socket(zmq.DEALER)
        self._identity = str(uuid.uuid4())
        self.socket.identity = service.encode()
        self.socket.identity = service

        # use with flags=zmq.DONTWAIT on send; also, any new message sent after
        # reaching HWM will be discarded (dealer)

M jackplug/plug.py => jackplug/plug.py +2 -2
@@ 94,7 94,7 @@ class PlugBase(object):
                        self._services_ping[service]['alive'] = False

                        if self._timeout_callback:
                            self._timeout_callback(service)
                            self._timeout_callback(service.decode())
                elif liveness < 0:
                    del self._services_ping[service]
                else:


@@ 138,7 138,7 @@ class PlugBase(object):
                self._services_ping[service]['id'] = identity

                if self._connection_callback:
                    self._connection_callback(service, True)
                    self._connection_callback(service.decode(), True)

            return