Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added multipart string reader #34

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ before_install: sudo apt-get install libzmq3-dev
rvm:
- 1.9.3
- 2.0.0
- 2.1.1
- ruby-head
- jruby-19mode
- jruby
- jruby-head
- rbx-19mode
- rbx-2

matrix:
allow_failures:
- rvm: jruby-19mode
- rvm: rbx-19mode
- rvm: ruby-head
- rvm: jruby-head
- rvm: rbx-2

notifications:
irc: "irc.freenode.org#celluloid"
7 changes: 4 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
source 'http://rubygems.org'
source 'https://rubygems.org'

# Specify your gem's dependencies in celluloid-zmq.gemspec
gemspec

gem 'coveralls', require: false
gem 'celluloid', github: 'celluloid/celluloid', branch: 'master'

# Specify your gem's dependencies in celluloid-zmq.gemspec
gemspec
10 changes: 10 additions & 0 deletions lib/celluloid/zmq/sockets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ def read(buffer = '')
end
buffer
end

# Read a multipart string message from the socket
def read_multipart(buffer = [])
ZMQ.wait_readable(@socket) if ZMQ.evented?

unless ::ZMQ::Util.resultcode_ok? @socket.recv_strings buffer
raise IOError, "error receiving ZMQ string: #{::ZMQ::Util.error_string}"
end
buffer
end

# Multiparts message ?
def_delegator :@socket, :more_parts?
Expand Down