Permalink
Browse files

Use new ZMQ API for sending messages

  • Loading branch information...
1 parent 94a8946 commit 0ac171619b6541fb7829cd8f420cca9f8587e609 @tarcieri tarcieri committed Feb 21, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/celluloid/zmq/sockets.rb
@@ -9,9 +9,11 @@ def initialize(type)
# Connect to the given 0MQ address
# Address should be in the form: tcp://1.2.3.4:5678/
def connect(addr)
+ puts "zomg connecting"
unless ::ZMQ::Util.resultcode_ok? @socket.connect addr
raise IOError, "error connecting to #{addr}: #{::ZMQ::Util.error_string}"
end
+ true
end
# Bind to the given 0MQ address
@@ -62,11 +64,10 @@ def read(buffer = '')
module WritableSocket
# Send a message to the socket
def send(message)
- Celluloid.current_actor.wait_writable(@socket) if evented?
-
- if ::ZMQ::Util.resultcode_ok? @socket.send_string message
+ unless ::ZMQ::Util.resultcode_ok? @socket.send_string message
raise IOError, "error sending 0MQ message: #{::ZMQ::Util.error_string}"
end
+
message
end
alias_method :<<, :send

0 comments on commit 0ac1716

Please sign in to comment.