lib/zmachine/zmq_channel.rb in zmachine-0.2.0 vs lib/zmachine/zmq_channel.rb in zmachine-0.2.1
- old
+ new
@@ -23,10 +23,17 @@
@bound = false
@connected = false
@closed = false
end
+ def identity=(v)
+ @socket.identity = v if @socket
+ end
+ def identity
+ @socket ? @socket.identity : nil
+ end
+
def selectable_fd
@socket.fd
end
def bind(address, port = nil)
@@ -74,23 +81,23 @@
def send1(a)
@socket.send_byte_array(a, ZMQ::DONTWAIT)
end
def send2(a, b)
- @socket.send_byte_array(a, ZMQ::DONTWAIT | ZMQ::DONTWAIT)
+ @socket.send_byte_array(a, ZMQ::SNDMORE | ZMQ::DONTWAIT)
@socket.send_byte_array(b, ZMQ::DONTWAIT)
end
def send3(a, b, c)
- @socket.send_byte_array(a, ZMQ::DONTWAIT | ZMQ::DONTWAIT)
- @socket.send_byte_array(b, ZMQ::DONTWAIT | ZMQ::DONTWAIT)
+ @socket.send_byte_array(a, ZMQ::SNDMORE | ZMQ::DONTWAIT)
+ @socket.send_byte_array(b, ZMQ::SNDMORE | ZMQ::DONTWAIT)
@socket.send_byte_array(c, ZMQ::DONTWAIT)
end
def send4(a, b, c, d)
- @socket.send_byte_array(a, ZMQ::DONTWAIT | ZMQ::DONTWAIT)
- @socket.send_byte_array(b, ZMQ::DONTWAIT | ZMQ::DONTWAIT)
- @socket.send_byte_array(c, ZMQ::DONTWAIT | ZMQ::DONTWAIT)
+ @socket.send_byte_array(a, ZMQ::SNDMORE | ZMQ::DONTWAIT)
+ @socket.send_byte_array(b, ZMQ::SNDMORE | ZMQ::DONTWAIT)
+ @socket.send_byte_array(c, ZMQ::SNDMORE | ZMQ::DONTWAIT)
@socket.send_byte_array(d, ZMQ::DONTWAIT)
end
def has_more?
@socket.events & ZMQ::Poller::POLLIN == ZMQ::Poller::POLLIN