em-zeromq 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/README.md +27 -15
- data/Rakefile +1 -0
- data/em-zeromq.gemspec +1 -0
- data/example/simple.rb +17 -9
- data/lib/em-zeromq/context.rb +18 -46
- data/lib/em-zeromq/{connection.rb → socket.rb} +4 -5
- data/lib/em-zeromq/version.rb +1 -1
- data/spec/context_spec.rb +2 -5
- data/spec/pub_sub_spec.rb +11 -4
- data/spec/push_pull_spec.rb +11 -4
- data/spec/router_dealer_spec.rb +10 -4
- data/spec/spec_helper.rb +5 -0
- metadata +27 -17
- data/lib/em-zeromq/rzmq_compat.rb +0 -26
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -12,6 +12,7 @@ EventMachine support for ZeroMQ
|
|
12
12
|
## Usage: ##
|
13
13
|
|
14
14
|
Supported on:
|
15
|
+
|
15
16
|
- MRI 1.9+
|
16
17
|
- Rubinius
|
17
18
|
- JRuby
|
@@ -29,7 +30,8 @@ to keep a reference to it in scope, this is what you don't want to do (that's ho
|
|
29
30
|
```ruby
|
30
31
|
EM.run do
|
31
32
|
context = EM::ZeroMQ::Context.new(1)
|
32
|
-
dealer_socket = context.
|
33
|
+
dealer_socket = context.sockt(...)
|
34
|
+
dealer_socket.connect(...)
|
33
35
|
dealer_socket.send_msg('', "ping")
|
34
36
|
end
|
35
37
|
```
|
@@ -42,42 +44,52 @@ It should not be a major problem anyway since code like above is only written fo
|
|
42
44
|
but I just pulled my hair trying to figure out why my test code was not working so now you
|
43
45
|
have been warned !
|
44
46
|
|
47
|
+
## Breaking changes: 0.2.x => 0.3.x ##
|
48
|
+
|
49
|
+
Until the gem hit the 1.0 mark you should not use the "~>" operator in your Gemfile,
|
50
|
+
lock yourself to the exact version you want. That said I will use the second digit to
|
51
|
+
flag api changes but be aware that small changes can still occur between releases.
|
52
|
+
|
45
53
|
|
46
54
|
## Example ##
|
47
55
|
```ruby
|
48
56
|
require 'rubygems'
|
49
57
|
require 'em-zeromq'
|
50
|
-
|
51
|
-
Thread.abort_on_exception = true
|
52
58
|
|
53
59
|
class EMTestPullHandler
|
54
60
|
attr_reader :received
|
55
|
-
def on_readable(socket,
|
56
|
-
|
61
|
+
def on_readable(socket, parts)
|
62
|
+
parts.each do |m|
|
57
63
|
puts m.copy_out_string
|
58
64
|
end
|
59
65
|
end
|
60
66
|
end
|
61
67
|
|
68
|
+
trap('INT') do
|
69
|
+
EM::stop()
|
70
|
+
end
|
62
71
|
|
63
72
|
ctx = EM::ZeroMQ::Context.new(1)
|
64
73
|
EM.run do
|
65
74
|
# setup push sockets
|
66
|
-
push_socket1 = ctx.
|
67
|
-
|
68
|
-
push_socket3 = ctx.bind( ZMQ::PUSH, 'inproc://simple_test')
|
75
|
+
push_socket1 = ctx.socket(ZMQ::PUSH)
|
76
|
+
push_socket1.bind('tcp://127.0.0.1:2091')
|
69
77
|
|
70
|
-
|
71
|
-
|
78
|
+
push_socket2 = ctx.socket(ZMQ::PUSH) do |s|
|
79
|
+
s.bind('ipc:///tmp/a')
|
80
|
+
end
|
81
|
+
|
82
|
+
push_socket3 = ctx.socket(ZMQ::PUSH)
|
83
|
+
push_socket3.bind('inproc://simple_test')
|
84
|
+
|
85
|
+
# setup one pull sockets listening to all push sockets
|
86
|
+
pull_socket = ctx.socket(ZMQ::PULL, EMTestPullHandler.new)
|
87
|
+
pull_socket.connect('tcp://127.0.0.1:2091')
|
72
88
|
pull_socket.connect('ipc:///tmp/a')
|
73
89
|
pull_socket.connect('inproc://simple_test')
|
74
90
|
|
75
91
|
n = 0
|
76
92
|
|
77
|
-
# push_socket.hwm = 40
|
78
|
-
# puts push_socket.hwm
|
79
|
-
# puts pull_socket.hwm
|
80
|
-
|
81
93
|
EM::PeriodicTimer.new(0.1) do
|
82
94
|
puts '.'
|
83
95
|
push_socket1.send_msg("t#{n += 1}_")
|
@@ -91,7 +103,7 @@ end
|
|
91
103
|
|
92
104
|
(The MIT License)
|
93
105
|
|
94
|
-
Copyright (c) 2011
|
106
|
+
Copyright (c) 2011 - 2012
|
95
107
|
|
96
108
|
Permission is hereby granted, free of charge, to any person obtaining
|
97
109
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
data/em-zeromq.gemspec
CHANGED
data/example/simple.rb
CHANGED
@@ -6,8 +6,8 @@ Thread.abort_on_exception = true
|
|
6
6
|
|
7
7
|
class EMTestPullHandler
|
8
8
|
attr_reader :received
|
9
|
-
def on_readable(socket,
|
10
|
-
|
9
|
+
def on_readable(socket, parts)
|
10
|
+
parts.each do |m|
|
11
11
|
puts m.copy_out_string
|
12
12
|
end
|
13
13
|
end
|
@@ -23,20 +23,28 @@ puts "Started (with zmq #{ZMQ::Util.version.join('.')})."
|
|
23
23
|
ctx = EM::ZeroMQ::Context.new(1)
|
24
24
|
EM.run do
|
25
25
|
# setup push sockets
|
26
|
-
push_socket1 = ctx.
|
27
|
-
|
28
|
-
|
26
|
+
push_socket1 = ctx.socket(ZMQ::PUSH)
|
27
|
+
|
28
|
+
push_socket1.hwm = 40
|
29
|
+
puts "HWM: #{push_socket1.hwm}"
|
30
|
+
|
31
|
+
push_socket1.bind('tcp://127.0.0.1:2091')
|
32
|
+
|
33
|
+
push_socket2 = ctx.socket(ZMQ::PUSH) do |s|
|
34
|
+
s.bind('ipc:///tmp/a')
|
35
|
+
end
|
36
|
+
|
37
|
+
push_socket3 = ctx.socket(ZMQ::PUSH)
|
38
|
+
push_socket3.bind('inproc://simple_test')
|
29
39
|
|
30
40
|
# setup one pull sockets listening to all push sockets
|
31
|
-
pull_socket = ctx.
|
41
|
+
pull_socket = ctx.socket(ZMQ::PULL, EMTestPullHandler.new)
|
42
|
+
pull_socket.connect('tcp://127.0.0.1:2091')
|
32
43
|
pull_socket.connect('ipc:///tmp/a')
|
33
44
|
pull_socket.connect('inproc://simple_test')
|
34
45
|
|
35
46
|
n = 0
|
36
47
|
|
37
|
-
push_socket1.hwm = 40
|
38
|
-
puts "HWM: #{push_socket1.hwm}"
|
39
|
-
|
40
48
|
EM::PeriodicTimer.new(0.1) do
|
41
49
|
puts '.'
|
42
50
|
push_socket1.send_msg("t#{n += 1}_")
|
data/lib/em-zeromq/context.rb
CHANGED
@@ -17,62 +17,34 @@ module EventMachine
|
|
17
17
|
@context = ZMQ::Context.new(threads_or_context)
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
21
|
-
def bind(socket_type, address, handler = nil, opts = {})
|
22
|
-
create(socket_type, :bind, address, handler, opts)
|
23
|
-
end
|
24
|
-
|
25
|
-
def connect(socket_type, address, handler = nil, opts = {})
|
26
|
-
create(socket_type, :connect, address, handler, opts)
|
27
|
-
end
|
28
20
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
if bind_or_connect == :bind
|
43
|
-
socket.bind(address)
|
44
|
-
else
|
45
|
-
socket.connect(address)
|
46
|
-
end
|
21
|
+
##
|
22
|
+
# Create a socket in this context.
|
23
|
+
#
|
24
|
+
# @param [Integer] socket_type One of ZMQ::REQ, ZMQ::REP, ZMQ::PULL, ZMQ::PUSH,
|
25
|
+
# ZMQ::ROUTER, ZMQ::DEALER
|
26
|
+
#
|
27
|
+
# @param [Object] handler an object which respond to on_readable(socket, parts)
|
28
|
+
# and can respond to on_writeable(socket)
|
29
|
+
#
|
30
|
+
def socket(socket_type, handler = nil)
|
31
|
+
zmq_socket = @context.socket(socket_type)
|
47
32
|
|
48
33
|
fd = []
|
49
|
-
if
|
34
|
+
if zmq_socket.getsockopt(ZMQ::FD, fd) < 0
|
50
35
|
raise "Unable to get socket FD: #{ZMQ::Util.error_string}"
|
51
36
|
end
|
52
37
|
|
53
|
-
conn = EM.watch(fd[0], EventMachine::ZeroMQ::Connection, socket, socket_type, address, handler)
|
54
|
-
|
55
|
-
if READABLES.include?(socket_type)
|
56
|
-
conn.register_readable
|
57
|
-
end
|
58
38
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
private
|
67
|
-
def find_type(type)
|
68
|
-
if type.is_a?(Symbol) or type.is_a?(String)
|
69
|
-
ZMQ.const_get(type.to_s.upcase)
|
70
|
-
else
|
71
|
-
type
|
39
|
+
EM.watch(fd[0], EventMachine::ZeroMQ::Socket, zmq_socket, socket_type, handler).tap do |s|
|
40
|
+
s.register_readable if READABLES.include?(socket_type)
|
41
|
+
s.register_writable if WRITABLES.include?(socket_type)
|
42
|
+
|
43
|
+
yield(s) if block_given?
|
72
44
|
end
|
73
45
|
end
|
74
46
|
|
75
47
|
end
|
76
|
-
|
48
|
+
|
77
49
|
end
|
78
50
|
end
|
@@ -1,14 +1,13 @@
|
|
1
1
|
module EventMachine
|
2
2
|
module ZeroMQ
|
3
|
-
class
|
3
|
+
class Socket < EventMachine::Connection
|
4
4
|
attr_accessor :on_readable, :on_writable, :handler
|
5
|
-
attr_reader :socket, :socket_type
|
5
|
+
attr_reader :socket, :socket_type
|
6
6
|
|
7
|
-
def initialize(socket, socket_type,
|
7
|
+
def initialize(socket, socket_type, handler)
|
8
8
|
@socket = socket
|
9
9
|
@socket_type = socket_type
|
10
10
|
@handler = handler
|
11
|
-
@address = address
|
12
11
|
end
|
13
12
|
|
14
13
|
def self.map_sockopt(opt, name)
|
@@ -176,7 +175,7 @@ module EventMachine
|
|
176
175
|
def get_message
|
177
176
|
msg = ZMQ::Message.new
|
178
177
|
msg_recvd = @socket.recv(msg, ZMQ::NOBLOCK)
|
179
|
-
msg_recvd ? msg : nil
|
178
|
+
msg_recvd != -1 ? msg : nil
|
180
179
|
end
|
181
180
|
|
182
181
|
# Detaches the socket from the EM loop,
|
data/lib/em-zeromq/version.rb
CHANGED
data/spec/context_spec.rb
CHANGED
@@ -13,11 +13,8 @@ describe 'Context' do
|
|
13
13
|
|
14
14
|
it 'can create socket' do
|
15
15
|
EM::run do
|
16
|
-
|
17
|
-
|
18
|
-
s3 = @ctx.bind(ZMQ::ROUTER, 'tcp://127.0.0.1:5557')
|
19
|
-
|
20
|
-
s1.instance_variable_get('@socket').name.should == 'ROUTER'
|
16
|
+
s = @ctx.socket(ZMQ::ROUTER)
|
17
|
+
s.instance_variable_get('@socket').name.should == 'ROUTER'
|
21
18
|
EM::stop_event_loop
|
22
19
|
end
|
23
20
|
end
|
data/spec/pub_sub_spec.rb
CHANGED
@@ -13,10 +13,13 @@ describe EventMachine::ZeroMQ do
|
|
13
13
|
|
14
14
|
it "Should instantiate a connection given valid opts" do
|
15
15
|
sub_conn = nil
|
16
|
+
address = rand_addr
|
17
|
+
|
16
18
|
run_reactor(1) do
|
17
|
-
sub_conn = SPEC_CTX.
|
19
|
+
sub_conn = SPEC_CTX.socket(ZMQ::PUB, EMTestSubHandler.new)
|
20
|
+
sub_conn.bind(address)
|
18
21
|
end
|
19
|
-
sub_conn.should be_a(EventMachine::ZeroMQ::
|
22
|
+
sub_conn.should be_a(EventMachine::ZeroMQ::Socket)
|
20
23
|
end
|
21
24
|
|
22
25
|
describe "sending/receiving a single message via PUB/SUB" do
|
@@ -25,11 +28,15 @@ describe EventMachine::ZeroMQ do
|
|
25
28
|
@test_message = test_message = "TMsg#{rand(999)}"
|
26
29
|
|
27
30
|
run_reactor(0.5) do
|
31
|
+
address = rand_addr
|
32
|
+
|
28
33
|
results[:sub_hndlr] = pull_hndlr = EMTestSubHandler.new
|
29
|
-
sub_conn = SPEC_CTX.
|
34
|
+
sub_conn = SPEC_CTX.socket(ZMQ::SUB, pull_hndlr)
|
35
|
+
sub_conn.bind(address)
|
30
36
|
sub_conn.subscribe('')
|
31
37
|
|
32
|
-
pub_conn = SPEC_CTX.
|
38
|
+
pub_conn = SPEC_CTX.socket(ZMQ::PUB, EMTestSubHandler.new)
|
39
|
+
pub_conn.connect(address)
|
33
40
|
|
34
41
|
pub_conn.socket.send_string test_message, ZMQ::NOBLOCK
|
35
42
|
|
data/spec/push_pull_spec.rb
CHANGED
@@ -14,9 +14,10 @@ describe EventMachine::ZeroMQ do
|
|
14
14
|
it "Should instantiate a connection given valid opts" do
|
15
15
|
pull_conn = nil
|
16
16
|
run_reactor do
|
17
|
-
pull_conn = SPEC_CTX.
|
17
|
+
pull_conn = SPEC_CTX.socket(ZMQ::PULL, EMTestPullHandler.new)
|
18
|
+
pull_conn.bind(rand_addr)
|
18
19
|
end
|
19
|
-
pull_conn.should be_a(EventMachine::ZeroMQ::
|
20
|
+
pull_conn.should be_a(EventMachine::ZeroMQ::Socket)
|
20
21
|
end
|
21
22
|
|
22
23
|
describe "sending/receiving a single message via PUB/SUB" do
|
@@ -25,9 +26,15 @@ describe EventMachine::ZeroMQ do
|
|
25
26
|
@test_message = test_message = "TMsg#{rand(999)}"
|
26
27
|
|
27
28
|
run_reactor(0.5) do
|
29
|
+
|
30
|
+
address = rand_addr
|
31
|
+
|
28
32
|
results[:pull_hndlr] = pull_hndlr = EMTestPullHandler.new
|
29
|
-
pull_conn = SPEC_CTX.
|
30
|
-
|
33
|
+
pull_conn = SPEC_CTX.socket(ZMQ::PULL, pull_hndlr)
|
34
|
+
pull_conn.bind(address)
|
35
|
+
|
36
|
+
push_conn = SPEC_CTX.socket(ZMQ::PUSH)
|
37
|
+
push_conn.connect(address)
|
31
38
|
|
32
39
|
push_conn.socket.send_string test_message, ZMQ::NOBLOCK
|
33
40
|
|
data/spec/router_dealer_spec.rb
CHANGED
@@ -33,9 +33,10 @@ describe EventMachine::ZeroMQ do
|
|
33
33
|
it "Should instantiate a connection given valid opts for Router/Dealer" do
|
34
34
|
router_conn = nil
|
35
35
|
run_reactor(1) do
|
36
|
-
router_conn = SPEC_CTX.
|
36
|
+
router_conn = SPEC_CTX.socket(ZMQ::ROUTER, EMTestRouterHandler.new)
|
37
|
+
router_conn.bind(rand_addr)
|
37
38
|
end
|
38
|
-
router_conn.should be_a(EventMachine::ZeroMQ::
|
39
|
+
router_conn.should be_a(EventMachine::ZeroMQ::Socket)
|
39
40
|
end
|
40
41
|
|
41
42
|
describe "sending/receiving a single message via Router/Dealer" do
|
@@ -48,8 +49,13 @@ describe EventMachine::ZeroMQ do
|
|
48
49
|
results[:router_hndlr] = router_hndlr = EMTestRouterHandler.new
|
49
50
|
|
50
51
|
addr = rand_addr
|
51
|
-
dealer_conn = SPEC_CTX.
|
52
|
-
|
52
|
+
dealer_conn = SPEC_CTX.socket(ZMQ::DEALER, dealer_hndlr)
|
53
|
+
dealer_conn.identity = "dealer1"
|
54
|
+
dealer_conn.bind(addr)
|
55
|
+
|
56
|
+
router_conn = SPEC_CTX.socket(ZMQ::ROUTER, router_hndlr)
|
57
|
+
router_conn.identity = "router1"
|
58
|
+
router_conn.connect(addr)
|
53
59
|
|
54
60
|
EM::add_timer(0.1) do
|
55
61
|
router_conn.send_msg('dealer1','', test_message)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-zeromq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-03-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: eventmachine
|
17
|
-
requirement: &
|
17
|
+
requirement: &70098716501040 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - =
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 1.0.0.beta.4
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70098716501040
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: ffi
|
28
|
-
requirement: &
|
28
|
+
requirement: &70098716500480 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70098716500480
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: ffi-rzmq
|
39
|
-
requirement: &
|
39
|
+
requirement: &70098716499780 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - =
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 0.9.3
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70098716499780
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rspec
|
50
|
-
requirement: &
|
50
|
+
requirement: &70098716498920 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,21 @@ dependencies:
|
|
55
55
|
version: 2.5.0
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70098716498920
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: simplecov
|
61
|
+
requirement: &70098716498140 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *70098716498140
|
59
70
|
- !ruby/object:Gem::Dependency
|
60
71
|
name: rake
|
61
|
-
requirement: &
|
72
|
+
requirement: &70098716373420 !ruby/object:Gem::Requirement
|
62
73
|
none: false
|
63
74
|
requirements:
|
64
75
|
- - ! '>='
|
@@ -66,7 +77,7 @@ dependencies:
|
|
66
77
|
version: '0'
|
67
78
|
type: :development
|
68
79
|
prerelease: false
|
69
|
-
version_requirements: *
|
80
|
+
version_requirements: *70098716373420
|
70
81
|
description: Low level event machine support for ZeroMQ
|
71
82
|
email:
|
72
83
|
- schmurfy@gmail.com
|
@@ -83,9 +94,8 @@ files:
|
|
83
94
|
- em-zeromq.gemspec
|
84
95
|
- example/simple.rb
|
85
96
|
- lib/em-zeromq.rb
|
86
|
-
- lib/em-zeromq/connection.rb
|
87
97
|
- lib/em-zeromq/context.rb
|
88
|
-
- lib/em-zeromq/
|
98
|
+
- lib/em-zeromq/socket.rb
|
89
99
|
- lib/em-zeromq/version.rb
|
90
100
|
- spec/context_spec.rb
|
91
101
|
- spec/pub_sub_spec.rb
|
@@ -108,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
108
118
|
version: '0'
|
109
119
|
segments:
|
110
120
|
- 0
|
111
|
-
hash:
|
121
|
+
hash: 4514270127933019528
|
112
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
123
|
none: false
|
114
124
|
requirements:
|
@@ -117,10 +127,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
127
|
version: '0'
|
118
128
|
segments:
|
119
129
|
- 0
|
120
|
-
hash:
|
130
|
+
hash: 4514270127933019528
|
121
131
|
requirements: []
|
122
132
|
rubyforge_project: em-zeromq
|
123
|
-
rubygems_version: 1.8.
|
133
|
+
rubygems_version: 1.8.11
|
124
134
|
signing_key:
|
125
135
|
specification_version: 3
|
126
136
|
summary: Low level event machine support for ZeroMQ
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module RZMQCompat
|
2
|
-
class ZMQError < RuntimeError; end
|
3
|
-
class ZMQOperationFailed < ZMQError; end
|
4
|
-
|
5
|
-
def self.included(klass)
|
6
|
-
klass.instance_eval do
|
7
|
-
%w(recv).each do |m|
|
8
|
-
alias_method :"#{m}_without_raise", m.to_sym
|
9
|
-
alias_method m.to_sym, :"#{m}_with_raise"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def recv_with_raise(msg, flags = 0)
|
15
|
-
ret = recv_without_raise(msg, flags)
|
16
|
-
if (ret == true) || (ret == 0)
|
17
|
-
true
|
18
|
-
else
|
19
|
-
false
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
ZMQ::Socket.send(:include, RZMQCompat)
|