Add libzmq 3.2.x compatibility.

pyzmq compiled with zeromq-3.2 does not have HWM socket opt. Instead
of this, exists SNDHWM that replaces it.
This commit is contained in:
Andrey Antukh 2012-11-30 22:08:59 +01:00 committed by Ask Solem
parent f9e09b65f5
commit c70b2dc0ec
1 changed files with 6 additions and 1 deletions

View File

@ -111,7 +111,12 @@ class Client(object):
self.sink = None
self.vent = self.context.socket(zmq.PUSH)
self.vent.setsockopt(zmq.HWM, hwm)
if hasattr(zmq, 'SNDHWM'):
self.vent.setsockopt(zmq.SNDHWM, hwm)
else:
self.vent.setsockopt(zmq.HWM, hwm)
if swap_size:
self.vent.setsockopt(zmq.SWAP, swap_size)