rbczmq 1.7.2 → 1.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +9 -9
- data/.gitmodules +1 -1
- data/CHANGELOG.rdoc +4 -0
- data/Gemfile.lock +1 -1
- data/ext/czmq/model/sockopts.xml +1 -1
- data/ext/czmq/src/zsockopt.c +330 -0
- data/ext/rbczmq/loop.c +21 -3
- data/ext/rbczmq/loop.h +1 -0
- data/ext/zeromq/NEWS +42 -2
- data/ext/zeromq/doc/zmq_ipc.txt +5 -0
- data/ext/zeromq/include/zmq.h +103 -128
- data/ext/zeromq/src/ctx.hpp +2 -2
- data/ext/zeromq/src/ipc_address.cpp +15 -4
- data/lib/zmq/version.rb +1 -1
- data/test/test_beacon.rb +26 -9
- metadata +3 -3
@@ -51,11 +51,18 @@ int zmq::ipc_address_t::resolve (const char *path_)
|
|
51
51
|
errno = ENAMETOOLONG;
|
52
52
|
return -1;
|
53
53
|
}
|
54
|
+
#if defined ZMQ_HAVE_LINUX
|
55
|
+
if (path_[0] == '@' && !path_[1]) {
|
56
|
+
errno = EINVAL;
|
57
|
+
return -1;
|
58
|
+
}
|
59
|
+
#endif
|
54
60
|
|
55
61
|
address.sun_family = AF_UNIX;
|
56
62
|
strcpy (address.sun_path, path_);
|
57
63
|
#if defined ZMQ_HAVE_LINUX
|
58
|
-
|
64
|
+
/* Abstract sockets on Linux start with '\0' */
|
65
|
+
if (path_[0] == '@')
|
59
66
|
*address.sun_path = '\0';
|
60
67
|
#endif
|
61
68
|
return 0;
|
@@ -73,10 +80,10 @@ int zmq::ipc_address_t::to_string (std::string &addr_)
|
|
73
80
|
s << "ipc://" << address.sun_path;
|
74
81
|
#else
|
75
82
|
s << "ipc://";
|
76
|
-
if (
|
77
|
-
s << address.sun_path;
|
78
|
-
else
|
83
|
+
if (!address.sun_path[0] && address.sun_path[1])
|
79
84
|
s << "@" << address.sun_path + 1;
|
85
|
+
else
|
86
|
+
s << address.sun_path;
|
80
87
|
#endif
|
81
88
|
addr_ = s.str ();
|
82
89
|
return 0;
|
@@ -89,6 +96,10 @@ const sockaddr *zmq::ipc_address_t::addr () const
|
|
89
96
|
|
90
97
|
socklen_t zmq::ipc_address_t::addrlen () const
|
91
98
|
{
|
99
|
+
#if defined ZMQ_HAVE_LINUX
|
100
|
+
if (!address.sun_path[0] && address.sun_path[1])
|
101
|
+
return (socklen_t) strlen(address.sun_path + 1) + sizeof (sa_family_t) + 1;
|
102
|
+
#endif
|
92
103
|
return (socklen_t) sizeof (address);
|
93
104
|
}
|
94
105
|
|
data/lib/zmq/version.rb
CHANGED
data/test/test_beacon.rb
CHANGED
@@ -1,10 +1,27 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
require File.join(File.dirname(__FILE__), 'helper')
|
4
|
+
require 'socket'
|
4
5
|
|
5
6
|
class TestZmqBeacon < ZmqTestCase
|
7
|
+
def setup
|
8
|
+
r = Random.new
|
9
|
+
begin
|
10
|
+
# find a random port number that we are able to bind to, and use this port
|
11
|
+
# for the beacon tests.
|
12
|
+
udp = UDPSocket.new
|
13
|
+
@port = 10000 + r.rand(50000)
|
14
|
+
udp.bind('0.0.0.0', @port)
|
15
|
+
rescue Errno::EADDRINUSE
|
16
|
+
udp.close
|
17
|
+
retry
|
18
|
+
ensure
|
19
|
+
udp.close
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
6
23
|
def test_beacon
|
7
|
-
beacon = ZMQ::Beacon.new(
|
24
|
+
beacon = ZMQ::Beacon.new(@port)
|
8
25
|
assert_instance_of ZMQ::Beacon, beacon
|
9
26
|
assert_nil beacon.destroy
|
10
27
|
assert_raises TypeError do
|
@@ -15,14 +32,14 @@ class TestZmqBeacon < ZmqTestCase
|
|
15
32
|
end
|
16
33
|
|
17
34
|
def test_hostname
|
18
|
-
beacon = ZMQ::Beacon.new(
|
35
|
+
beacon = ZMQ::Beacon.new(@port)
|
19
36
|
assert_instance_of String, beacon.hostname
|
20
37
|
ensure
|
21
38
|
beacon.destroy
|
22
39
|
end
|
23
40
|
|
24
41
|
def test_set_interval
|
25
|
-
beacon = ZMQ::Beacon.new(
|
42
|
+
beacon = ZMQ::Beacon.new(@port)
|
26
43
|
beacon.interval = 100
|
27
44
|
assert_raises TypeError do
|
28
45
|
beacon.interval = :invalid
|
@@ -32,14 +49,14 @@ class TestZmqBeacon < ZmqTestCase
|
|
32
49
|
end
|
33
50
|
|
34
51
|
def test_noecho
|
35
|
-
beacon = ZMQ::Beacon.new(
|
52
|
+
beacon = ZMQ::Beacon.new(@port)
|
36
53
|
assert_nil beacon.noecho
|
37
54
|
ensure
|
38
55
|
beacon.destroy
|
39
56
|
end
|
40
57
|
|
41
58
|
def test_publish
|
42
|
-
beacon = ZMQ::Beacon.new(
|
59
|
+
beacon = ZMQ::Beacon.new(@port)
|
43
60
|
assert_raises TypeError do
|
44
61
|
beacon.publish :invalid
|
45
62
|
end
|
@@ -50,7 +67,7 @@ class TestZmqBeacon < ZmqTestCase
|
|
50
67
|
end
|
51
68
|
|
52
69
|
def test_subscribe
|
53
|
-
beacon = ZMQ::Beacon.new(
|
70
|
+
beacon = ZMQ::Beacon.new(@port)
|
54
71
|
assert_raises TypeError do
|
55
72
|
beacon.subscribe :invalid
|
56
73
|
end
|
@@ -61,7 +78,7 @@ class TestZmqBeacon < ZmqTestCase
|
|
61
78
|
end
|
62
79
|
|
63
80
|
def test_pipe
|
64
|
-
beacon = ZMQ::Beacon.new(
|
81
|
+
beacon = ZMQ::Beacon.new(@port)
|
65
82
|
assert_instance_of ZMQ::Socket::Pair, beacon.pipe
|
66
83
|
GC.start # check GC cycle with "detached" socket
|
67
84
|
ensure
|
@@ -72,10 +89,10 @@ class TestZmqBeacon < ZmqTestCase
|
|
72
89
|
ctx = ZMQ::Context.new
|
73
90
|
address = "tcp://127.0.0.1:90000"
|
74
91
|
rep = ctx.bind(:REP, address)
|
75
|
-
service_beacon = ZMQ::Beacon.new(
|
92
|
+
service_beacon = ZMQ::Beacon.new(@port)
|
76
93
|
service_beacon.publish(address)
|
77
94
|
sleep(0.5)
|
78
|
-
client_beacon = ZMQ::Beacon.new(
|
95
|
+
client_beacon = ZMQ::Beacon.new(@port)
|
79
96
|
client_beacon.subscribe("tcp")
|
80
97
|
client_beacon.pipe.rcvtimeo = 1000
|
81
98
|
sender_address = client_beacon.pipe.recv
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbczmq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lourens Naudé
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-11-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake-compiler
|
@@ -646,7 +646,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
646
646
|
version: '0'
|
647
647
|
requirements: []
|
648
648
|
rubyforge_project:
|
649
|
-
rubygems_version: 2.
|
649
|
+
rubygems_version: 2.1.9
|
650
650
|
signing_key:
|
651
651
|
specification_version: 4
|
652
652
|
summary: Ruby extension for ZeroMQ (ZMQ) using CZMQ - High-level C Binding for ØMQ
|