ffi-rzmq 1.0.3 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +1 -1
- data/AUTHORS.txt +5 -1
- data/History.txt +19 -0
- data/README.rdoc +2 -4
- data/examples/README.rdoc +1 -3
- data/examples/{v3api/latency_measurement.rb → latency_measurement.rb} +1 -2
- data/examples/{v3api/local_lat.rb → local_lat.rb} +1 -1
- data/examples/{v3api/local_lat_poll.rb → local_lat_poll.rb} +4 -4
- data/examples/{v3api/local_throughput.rb → local_throughput.rb} +1 -1
- data/examples/{v3api/pub.rb → pub.rb} +1 -1
- data/examples/{v2api/publish_subscribe.rb → publish_subscribe.rb} +2 -2
- data/examples/{v2api/remote_lat.rb → remote_lat.rb} +1 -1
- data/examples/{v3api/remote_throughput.rb → remote_throughput.rb} +4 -3
- data/examples/{v2api/reqrep_poll.rb → reqrep_poll.rb} +3 -4
- data/examples/{v2api/request_response.rb → request_response.rb} +1 -2
- data/examples/{v3api/sub.rb → sub.rb} +1 -2
- data/examples/{v3api/throughput_measurement.rb → throughput_measurement.rb} +1 -1
- data/examples/{v3api/xreqxrep_poll.rb → xreqxrep_poll.rb} +6 -7
- data/ffi-rzmq.gemspec +4 -4
- data/lib/ffi-rzmq.rb +2 -3
- data/lib/ffi-rzmq/context.rb +25 -53
- data/lib/ffi-rzmq/device.rb +8 -4
- data/lib/ffi-rzmq/message.rb +24 -30
- data/lib/ffi-rzmq/poll.rb +5 -16
- data/lib/ffi-rzmq/socket.rb +129 -278
- data/lib/ffi-rzmq/util.rb +11 -36
- data/lib/ffi-rzmq/version.rb +1 -1
- data/spec/context_spec.rb +3 -8
- data/spec/device_spec.rb +10 -9
- data/spec/nonblocking_recv_spec.rb +7 -7
- data/spec/pushpull_spec.rb +8 -7
- data/spec/reqrep_spec.rb +6 -6
- data/spec/socket_spec.rb +43 -130
- data/spec/spec_helper.rb +3 -11
- metadata +77 -104
- data/examples/v2api/latency_measurement.rb +0 -139
- data/examples/v2api/local_lat.rb +0 -58
- data/examples/v2api/local_lat_poll.rb +0 -66
- data/examples/v2api/local_throughput.rb +0 -58
- data/examples/v2api/pub.rb +0 -46
- data/examples/v2api/remote_throughput.rb +0 -39
- data/examples/v2api/sub.rb +0 -74
- data/examples/v2api/throughput_measurement.rb +0 -138
- data/examples/v2api/xreqxrep_poll.rb +0 -93
- data/examples/v3api/publish_subscribe.rb +0 -82
- data/examples/v3api/remote_lat.rb +0 -71
- data/examples/v3api/reqrep_poll.rb +0 -62
- data/examples/v3api/request_response.rb +0 -40
- data/lib/ffi-rzmq/constants.rb +0 -187
- data/lib/ffi-rzmq/libc.rb +0 -19
- data/lib/ffi-rzmq/libzmq.rb +0 -283
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a406c4de564eef119c3f303a386546d6bfda94fd
|
4
|
+
data.tar.gz: 4ef6371ae1029809d302dc7911d0a5a056328428
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 801813a1a358e60fc0906369c1da88638bdb2c91588da12c50adf2b5869b8542690baa14b3d6098f2ba34e74fcb9468631c5f23ac21dba216782be21a654406d
|
7
|
+
data.tar.gz: 88e1a7bdc0500f6703e94ace2c145f96420fafa89b0bd39927edd5f4a396ca36a4a0bbb543d57b517b115eae5ffb9c55288b1b568fc4ae11f8acee903ceaa1b1
|
data/.travis.yml
CHANGED
data/AUTHORS.txt
CHANGED
data/History.txt
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
|
2
|
+
== 2.0.0 / 20140108
|
3
|
+
* Split out all of the FFI code to its own gem so other projects can use
|
4
|
+
it without the effort of duplication.
|
5
|
+
|
6
|
+
* Support libzmq 4 API and its new security API . Thanks to Devin
|
7
|
+
Christensen (devin-c) and Jason Roelofs (jasonroelofs) for related
|
8
|
+
patches.
|
9
|
+
|
10
|
+
* Minor documentation fixes. Thanks to Michael Zaccari (mzaccari) for
|
11
|
+
the fix.
|
12
|
+
|
13
|
+
* Improved the readability of any FFI code (now moved to ffi-rzmq-core
|
14
|
+
project). Thanks to Stephen von Takach (stakach) for the patch.
|
15
|
+
|
16
|
+
* Updated AUTHORS.txt
|
17
|
+
|
18
|
+
|
19
|
+
|
1
20
|
== 1.0.3 / 20131003
|
2
21
|
* Fixes for issues #96 and #97. Thanks to Paul Chechetin (paulche) for
|
3
22
|
the issues and patches.
|
data/README.rdoc
CHANGED
@@ -122,17 +122,15 @@ I highly recommend visiting the Learn Ruby 0mq project for a bunch of good code
|
|
122
122
|
|
123
123
|
== REQUIREMENTS:
|
124
124
|
|
125
|
-
* 0mq
|
125
|
+
* 0mq 3.2.x, 4.x or later; 2.x, 3.0.x and 3.1.x are no longer supported
|
126
126
|
|
127
127
|
The ZeroMQ library must be installed on your system in a well-known location
|
128
128
|
like /usr/local/lib. This is the default for new ZeroMQ installs.
|
129
129
|
|
130
130
|
If you have installed ZeroMQ using brew, you need to `brew link zeromq` before installing this gem.
|
131
131
|
|
132
|
-
Future releases may include the library as a C extension built at
|
133
|
-
time of installation.
|
134
|
-
|
135
132
|
* ffi (>= 1.0.0)
|
133
|
+
* ffi-rzmq-core
|
136
134
|
|
137
135
|
This is a requirement for MRI and Rubinius. JRuby has FFI support built
|
138
136
|
in as a standard component. Do *not* run this gem under MRI with an old 'ffi' gem.
|
data/examples/README.rdoc
CHANGED
@@ -4,14 +4,12 @@
|
|
4
4
|
|
5
5
|
1. lib dir
|
6
6
|
|
7
|
-
All of the examples assume the lib directory containing the gem sources is
|
7
|
+
All of the examples assume the lib directory containing the gem sources is one directory up from the location of the example.
|
8
8
|
|
9
9
|
2. Installed libzmq library
|
10
10
|
|
11
11
|
The ZeroMQ C libraries need to be downloaded, compiled and installed separately from the gem. Please see http://www.zeromq.org/area:download for links to the downloadable files along with some simple installation instructions. Also, be sure to check the FAQ if you run into problems with compiling.
|
12
12
|
|
13
|
-
This gem auto-configures itself to conform to the API for 0mq 2.1.x and 3.1.x. The 0mq project started making backward-incompatible changes with the 3.x branch. Rather than create separate gems, this one handles all of them.
|
14
|
-
|
15
13
|
It is possible to install the libzmq* files directly into the gem in the ext/ directory. This directory is checked for loadable libraries first before it falls back to checking the system paths.
|
16
14
|
|
17
15
|
3. One terminal window
|
@@ -1,6 +1,5 @@
|
|
1
1
|
|
2
|
-
require File.join(File.dirname(__FILE__), '..', '
|
3
|
-
|
2
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'ffi-rzmq')
|
4
3
|
|
5
4
|
# Within a single process, we start up two threads. One thread has a REQ (request)
|
6
5
|
# socket and the second thread has a REP (reply) socket. We measure the
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# You should have received a copy of the Lesser GNU General Public License
|
17
17
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
|
19
|
-
require File.join(File.dirname(__FILE__), '..', '
|
19
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'ffi-rzmq')
|
20
20
|
|
21
21
|
if ARGV.length < 3
|
22
22
|
puts "usage: ruby local_lat.rb <connect-to> <message-size> <roundtrip-count>"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
require File.join(File.dirname(__FILE__), '..', '
|
2
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'ffi-rzmq')
|
3
3
|
|
4
4
|
if ARGV.length < 3
|
5
5
|
puts "usage: ruby local_lat.rb <connect-to> <message-size> <roundtrip-count>"
|
@@ -38,7 +38,7 @@ start_time = Time.now
|
|
38
38
|
|
39
39
|
# kick it off
|
40
40
|
message = ZMQ::Message.new("a" * message_size)
|
41
|
-
assert(s1.sendmsg(message, ZMQ::
|
41
|
+
assert(s1.sendmsg(message, ZMQ::DONTWAIT))
|
42
42
|
|
43
43
|
i = roundtrip_count
|
44
44
|
|
@@ -49,8 +49,8 @@ until i.zero?
|
|
49
49
|
|
50
50
|
poller.readables.each do |socket|
|
51
51
|
received_message = ''
|
52
|
-
assert(socket.recv_string(received_message, ZMQ::
|
53
|
-
assert(socket.sendmsg(ZMQ::Message.new(received_message), ZMQ::
|
52
|
+
assert(socket.recv_string(received_message, ZMQ::DONTWAIT))
|
53
|
+
assert(socket.sendmsg(ZMQ::Message.new(received_message), ZMQ::DONTWAIT))
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '..', '
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'ffi-rzmq')
|
2
2
|
|
3
3
|
|
4
4
|
def assert(rc)
|
@@ -71,7 +71,7 @@ assert(s4.recv_string(body)) if s4.more_parts?
|
|
71
71
|
puts "s4 received topic [#{topic}], body [#{body}]"
|
72
72
|
|
73
73
|
s5_string = ''
|
74
|
-
rc = s5.recv_string(s5_string, ZMQ::
|
74
|
+
rc = s5.recv_string(s5_string, ZMQ::DONTWAIT)
|
75
75
|
eagain = (rc == -1 && ZMQ::Util.errno == ZMQ::EAGAIN)
|
76
76
|
puts(eagain ? "s5 received no messages" : "s5 FAILED")
|
77
77
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
|
19
19
|
|
20
|
-
require File.join(File.dirname(__FILE__), '..', '
|
20
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'ffi-rzmq')
|
21
21
|
|
22
22
|
if ARGV.length < 3
|
23
23
|
puts "usage: ruby remote_lat.rb <connect-to> <message-size> <roundtrip-count>"
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
require File.join(File.dirname(__FILE__), '..', '
|
2
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'ffi-rzmq')
|
3
3
|
|
4
4
|
if ARGV.length != 3
|
5
5
|
puts "usage: ruby remote_throughput.rb <connect-to> <message-size> <message-count>"
|
@@ -27,9 +27,10 @@ end
|
|
27
27
|
#assert(s.setsockopt(ZMQ::SNDHWM, 0))
|
28
28
|
assert(s.connect(connect_to))
|
29
29
|
|
30
|
-
#
|
30
|
+
# give the downstream SUB socket a chance to register its
|
31
31
|
# subscription filters with this PUB socket
|
32
|
-
|
32
|
+
puts "Hit any key to start publishing"
|
33
|
+
STDIN.gets
|
33
34
|
|
34
35
|
contents = "#{'0'*message_size}"
|
35
36
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
|
2
|
-
require File.join(File.dirname(__FILE__), '..', '
|
3
|
-
|
2
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'ffi-rzmq')
|
4
3
|
|
5
4
|
def assert(rc)
|
6
5
|
raise "Last API call failed at #{caller(1)}" unless rc >= 0
|
@@ -38,7 +37,7 @@ until @done do
|
|
38
37
|
payload = "#{ '3' * 1024 }"
|
39
38
|
|
40
39
|
puts "sending payload nonblocking"
|
41
|
-
assert(s1.send_string(payload, ZMQ::
|
40
|
+
assert(s1.send_string(payload, ZMQ::DONTWAIT))
|
42
41
|
@unsent = false
|
43
42
|
end
|
44
43
|
|
@@ -46,7 +45,7 @@ until @done do
|
|
46
45
|
if Time.now - start_time > 1
|
47
46
|
poller.readables.each do |sock|
|
48
47
|
received_msg = ''
|
49
|
-
assert(sock.recv_string(received_msg, ZMQ::
|
48
|
+
assert(sock.recv_string(received_msg, ZMQ::DONTWAIT))
|
50
49
|
|
51
50
|
puts "message received [#{received_msg}]"
|
52
51
|
@done = true
|
@@ -1,11 +1,10 @@
|
|
1
1
|
|
2
|
-
require File.join(File.dirname(__FILE__), '..', '
|
2
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'ffi-rzmq')
|
3
3
|
|
4
4
|
#if ARGV.length != 3
|
5
5
|
# puts "usage: ruby local_throughtput.rb <bind-to> <message-size> <message-count>"
|
6
6
|
# Process.exit
|
7
7
|
#end
|
8
|
-
p ZMQ::Util.version
|
9
8
|
|
10
9
|
def assert(rc)
|
11
10
|
raise "Last API call failed at #{caller(1)}" unless rc >= 0
|
@@ -1,6 +1,5 @@
|
|
1
1
|
|
2
|
-
require File.join(File.dirname(__FILE__), '..', '
|
3
|
-
|
2
|
+
require File.join(File.dirname(__FILE__), '..', 'lib', 'ffi-rzmq')
|
4
3
|
|
5
4
|
def assert(rc)
|
6
5
|
raise "Last API call failed at #{caller(1)}" unless rc >= 0
|
@@ -43,7 +42,7 @@ until @done do
|
|
43
42
|
|
44
43
|
5.times do |i|
|
45
44
|
payload = "#{ i.to_s * 40 }"
|
46
|
-
assert(s1.send_string(payload, ZMQ::
|
45
|
+
assert(s1.send_string(payload, ZMQ::DONTWAIT))
|
47
46
|
end
|
48
47
|
@unsent = false
|
49
48
|
end
|
@@ -54,12 +53,12 @@ until @done do
|
|
54
53
|
|
55
54
|
if sock.identity =~ /xrep/
|
56
55
|
routing_info = ''
|
57
|
-
assert(sock.recv_string(routing_info, ZMQ::
|
56
|
+
assert(sock.recv_string(routing_info, ZMQ::DONTWAIT))
|
58
57
|
puts "routing_info received [#{routing_info}] on socket.identity [#{sock.identity}]"
|
59
58
|
else
|
60
59
|
routing_info = nil
|
61
60
|
received_msg = ''
|
62
|
-
assert(sock.recv_string(received_msg, ZMQ::
|
61
|
+
assert(sock.recv_string(received_msg, ZMQ::DONTWAIT))
|
63
62
|
|
64
63
|
# skip to the next iteration if received_msg is nil; that means we got an EAGAIN
|
65
64
|
next unless received_msg
|
@@ -68,13 +67,13 @@ until @done do
|
|
68
67
|
|
69
68
|
while sock.more_parts? do
|
70
69
|
received_msg = ''
|
71
|
-
assert(sock.recv_string(received_msg, ZMQ::
|
70
|
+
assert(sock.recv_string(received_msg, ZMQ::DONTWAIT))
|
72
71
|
|
73
72
|
puts "message received [#{received_msg}]"
|
74
73
|
end
|
75
74
|
|
76
75
|
puts "kick back a reply"
|
77
|
-
assert(sock.send_string(routing_info, ZMQ::SNDMORE | ZMQ::
|
76
|
+
assert(sock.send_string(routing_info, ZMQ::SNDMORE | ZMQ::DONTWAIT)) if routing_info
|
78
77
|
time = Time.now.strftime "%Y-%m-%dT%H:%M:%S.#{Time.now.usec}"
|
79
78
|
reply = "reply " + sock.identity.upcase + " #{time}"
|
80
79
|
puts "sent reply [#{reply}], #{time}"
|
data/ffi-rzmq.gemspec
CHANGED
@@ -11,9 +11,9 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = %q{This gem wraps the ZeroMQ (0mq) networking library using Ruby FFI (foreign function interface).}
|
12
12
|
s.description = %q{This gem wraps the ZeroMQ networking library using the ruby FFI (foreign
|
13
13
|
function interface). It's a pure ruby wrapper so this gem can be loaded
|
14
|
-
and run by any ruby runtime that supports FFI. That's all of the major ones -
|
15
|
-
MRI, Rubinius and JRuby.}
|
14
|
+
and run by any ruby runtime that supports FFI. That's all of the major ones - MRI, Rubinius and JRuby.}
|
16
15
|
|
16
|
+
s.license = 'MIT'
|
17
17
|
s.rubyforge_project = "ffi-rzmq"
|
18
18
|
|
19
19
|
s.files = `git ls-files`.split("\n")
|
@@ -21,7 +21,7 @@ MRI, Rubinius and JRuby.}
|
|
21
21
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
22
|
s.require_paths = ["lib"]
|
23
23
|
|
24
|
-
s.add_runtime_dependency "ffi"
|
25
|
-
s.add_development_dependency "rspec", ["~> 2.
|
24
|
+
s.add_runtime_dependency "ffi-rzmq-core", [">= 1.0.1"]
|
25
|
+
s.add_development_dependency "rspec", ["~> 2.14"]
|
26
26
|
s.add_development_dependency "rake"
|
27
27
|
end
|
data/lib/ffi-rzmq.rb
CHANGED
@@ -63,10 +63,9 @@ end # module ZMQ
|
|
63
63
|
# some code is conditionalized based upon what ruby engine we are
|
64
64
|
# executing
|
65
65
|
|
66
|
-
require 'ffi'
|
66
|
+
require 'ffi-rzmq-core'
|
67
67
|
|
68
68
|
# the order of files is important
|
69
|
-
|
70
|
-
%w(libc libzmq constants util exceptions context message socket poll_items poll_item poll device).each do |file|
|
69
|
+
%w(util exceptions context message socket poll_items poll_item poll device).each do |file|
|
71
70
|
require ZMQ.libpath(['ffi-rzmq', file])
|
72
71
|
end
|
data/lib/ffi-rzmq/context.rb
CHANGED
@@ -47,44 +47,29 @@ module ZMQ
|
|
47
47
|
|
48
48
|
# Use the factory method Context#create to make contexts.
|
49
49
|
#
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
def initialize io_threads = 1
|
56
|
-
@io_threads = io_threads
|
57
|
-
@context = LibZMQ.zmq_init io_threads
|
58
|
-
ZMQ::Util.error_check 'zmq_init', (@context.nil? || @context.null?) ? -1 : 0
|
59
|
-
|
60
|
-
define_finalizer
|
61
|
-
end
|
62
|
-
elsif LibZMQ.version3?
|
50
|
+
def self.create(opts = {})
|
51
|
+
new(opts) rescue nil
|
52
|
+
end
|
63
53
|
|
64
|
-
|
65
|
-
|
54
|
+
def initialize(opts = {})
|
55
|
+
if opts.respond_to?(:empty?)
|
56
|
+
@io_threads = opts[:io_threads] || IO_THREADS_DFLT
|
57
|
+
@max_sockets = opts[:max_sockets] || MAX_SOCKETS_DFLT
|
58
|
+
else
|
59
|
+
@io_threads = opts || 1
|
60
|
+
@max_sockets = MAX_SOCKETS_DFLT
|
66
61
|
end
|
67
62
|
|
68
|
-
|
69
|
-
|
70
|
-
@io_threads = opts[:io_threads] || IO_THREADS_DFLT
|
71
|
-
@max_sockets = opts[:max_sockets] || MAX_SOCKETS_DFLT
|
72
|
-
else
|
73
|
-
@io_threads = opts || 1
|
74
|
-
@max_sockets = MAX_SOCKETS_DFLT
|
75
|
-
end
|
76
|
-
|
77
|
-
@context = LibZMQ.zmq_ctx_new
|
78
|
-
ZMQ::Util.error_check 'zmq_ctx_new', (@context.nil? || @context.null?) ? -1 : 0
|
63
|
+
@context = LibZMQ.zmq_ctx_new
|
64
|
+
ZMQ::Util.error_check 'zmq_ctx_new', (@context.nil? || @context.null?) ? -1 : 0
|
79
65
|
|
80
|
-
|
81
|
-
|
66
|
+
rc = LibZMQ.zmq_ctx_set(@context, ZMQ::IO_THREADS, @io_threads)
|
67
|
+
ZMQ::Util.error_check 'zmq_ctx_set', rc
|
82
68
|
|
83
|
-
|
84
|
-
|
69
|
+
rc = LibZMQ.zmq_ctx_set(@context, ZMQ::MAX_SOCKETS, @max_sockets)
|
70
|
+
ZMQ::Util.error_check 'zmq_ctx_set', rc
|
85
71
|
|
86
|
-
|
87
|
-
end
|
72
|
+
define_finalizer
|
88
73
|
end
|
89
74
|
|
90
75
|
# Call to release the context and any remaining data associated
|
@@ -94,27 +79,14 @@ module ZMQ
|
|
94
79
|
#
|
95
80
|
# Returns 0 for success, -1 for failure.
|
96
81
|
#
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
0
|
106
|
-
end
|
107
|
-
end
|
108
|
-
elsif LibZMQ.version3?
|
109
|
-
def terminate
|
110
|
-
unless @context.nil? || @context.null?
|
111
|
-
remove_finalizer
|
112
|
-
rc = LibZMQ.zmq_ctx_destroy(@context)
|
113
|
-
@context = nil
|
114
|
-
rc
|
115
|
-
else
|
116
|
-
0
|
117
|
-
end
|
82
|
+
def terminate
|
83
|
+
unless @context.nil? || @context.null?
|
84
|
+
remove_finalizer
|
85
|
+
rc = LibZMQ.zmq_ctx_destroy(@context)
|
86
|
+
@context = nil
|
87
|
+
rc
|
88
|
+
else
|
89
|
+
0
|
118
90
|
end
|
119
91
|
end
|
120
92
|
|
data/lib/ffi-rzmq/device.rb
CHANGED
@@ -3,10 +3,10 @@ module ZMQ
|
|
3
3
|
class Device
|
4
4
|
attr_reader :device
|
5
5
|
|
6
|
-
def self.create(
|
6
|
+
def self.create(frontend, backend, capture=nil)
|
7
7
|
dev = nil
|
8
8
|
begin
|
9
|
-
dev = new(
|
9
|
+
dev = new(frontend, backend, capture)
|
10
10
|
rescue ArgumentError
|
11
11
|
dev = nil
|
12
12
|
end
|
@@ -14,15 +14,19 @@ module ZMQ
|
|
14
14
|
dev
|
15
15
|
end
|
16
16
|
|
17
|
-
def initialize(
|
17
|
+
def initialize(frontend, backend, capture=nil)
|
18
18
|
[["frontend", frontend], ["backend", backend]].each do |name, socket|
|
19
19
|
unless socket.is_a?(ZMQ::Socket)
|
20
20
|
raise ArgumentError, "Expected a ZMQ::Socket, not a #{socket.class} as the #{name}"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
LibZMQ.
|
24
|
+
LibZMQ.zmq_proxy(frontend.socket, backend.socket, capture ? capture.socket : nil)
|
25
25
|
end
|
26
26
|
end
|
27
|
+
|
28
|
+
# Alias for Device
|
29
|
+
#
|
30
|
+
class Proxy < Device; end
|
27
31
|
|
28
32
|
end
|