Subject: Re: missing events ZMQ_FD / ZMQ_EVENTS
Date: Wednesday 2nd May 2012 08:26:04 UTC (over 5 years ago)
btw, using the build in poller just works: ------- -- xpoller.lua --------- local zmq = require'zmq' zmq.poller = require'zmq.poller' local ev = require'ev' local c = zmq.init(1) local xreq = c:socket(zmq.XREQ) xreq:bind('tcp://127.0.0.1:13333') local xrep = c:socket(zmq.XREP) xrep:bind('tcp://127.0.0.1:13334') local is_readable = function(sock) local events = sock:getopt(zmq.EVENTS) return events == zmq.POLLIN or events == (zmq.POLLIN + zmq.POLLOUT) end local forward = function(src,dst) while is_readable(src) do repeat local data = assert(src:recv(zmq.NOBLOCK)) local more = src:getopt(zmq.RCVMORE) > 0 dst:send(data,more and zmq.SNDMORE or 0) until not more end end local xpoller = zmq.poller.new() xpoller:add(xreq,zmq.POLLIN, function() forward(xreq,xrep) end) xpoller:add(xrep,zmq.POLLIN, function() forward(xrep,xreq) end) xpoller:start() On Mon, Apr 23, 2012 at 2:53 PM, Gerhard Lipp <[email protected]> wrote: > Hello, > > I can observe the same behavior as stated here > (http://lists.zeromq.org/pipermail/zeromq-dev/2011-November/014615.html). > What I observe is also a XREP/XREQ (ROUTER/DEALER) prob, where the > XREQ is waiting forever to receive a message (which has been > definitely sent). When I poll (timer based) the ZMQ_EVENTs, the XREQ > is readable as expected. I am using libev (select based) for doing IO > and I am aware of the edge-based trigger behaviour (I am > reading/forwarding messages until ZMQ_EVENTs does not include the > ZMQ_POLLIN bit any more). > > What is the status of this issue? > Unfortunately my setup is a bit complicated to share, but i would like > to help as much as possible. > > Regards, > Gerhard > > A libev workaround is to use both EV_READ and EV_WRITE bits, though > this adds a lot of unnecessary wake ups / callbacks etc.