Fix ZMQ socketopt call order

This commit is contained in:
Kristóf Tóth 2019-07-08 20:12:12 +02:00
parent 9be21d88ac
commit 64ea7d8218

View File

@ -13,8 +13,8 @@ LOG = logging.getLogger(__name__)
class ServerDownlinkConnector(): class ServerDownlinkConnector():
def __init__(self, connect_addr): def __init__(self, connect_addr):
self._zmq_sub_socket = zmq.Context.instance().socket(zmq.SUB) self._zmq_sub_socket = zmq.Context.instance().socket(zmq.SUB)
self._zmq_sub_socket.connect(connect_addr)
self._zmq_sub_socket.setsockopt(zmq.RCVHWM, 0) self._zmq_sub_socket.setsockopt(zmq.RCVHWM, 0)
self._zmq_sub_socket.connect(connect_addr)
self._zmq_sub_stream = ZMQStream(self._zmq_sub_socket) self._zmq_sub_stream = ZMQStream(self._zmq_sub_socket)
self.subscribe = partial(self._zmq_sub_socket.setsockopt_string, zmq.SUBSCRIBE) self.subscribe = partial(self._zmq_sub_socket.setsockopt_string, zmq.SUBSCRIBE)
@ -31,8 +31,8 @@ class ServerDownlinkConnector():
class ServerUplinkConnector(): class ServerUplinkConnector():
def __init__(self, connect_addr): def __init__(self, connect_addr):
self._zmq_push_socket = zmq.Context.instance().socket(zmq.PUSH) self._zmq_push_socket = zmq.Context.instance().socket(zmq.PUSH)
self._zmq_push_socket.connect(connect_addr)
self._zmq_push_socket.setsockopt(zmq.SNDHWM, 0) self._zmq_push_socket.setsockopt(zmq.SNDHWM, 0)
self._zmq_push_socket.connect(connect_addr)
def send_message(self, message, scope=Scope.ZMQ): def send_message(self, message, scope=Scope.ZMQ):
message['scope'] = scope.value message['scope'] = scope.value