rbczmq 1.7.7 → 1.7.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +1 -0
- data/CHANGELOG.rdoc +5 -0
- data/Gemfile +0 -2
- data/Gemfile.lock +22 -26
- data/Rakefile +2 -1
- data/ext/rbczmq/beacon.c +9 -9
- data/ext/rbczmq/context.c +14 -5
- data/ext/rbczmq/context.h +2 -0
- data/ext/rbczmq/extconf.rb +2 -0
- data/ext/rbczmq/loop.c +1 -1
- data/ext/rbczmq/poller.c +1 -1
- data/ext/rbczmq/rbczmq_ext.c +18 -1
- data/ext/rbczmq/rbczmq_prelude.h +2 -2
- data/ext/rbczmq/ruby2.h +13 -0
- data/ext/rbczmq/socket.c +13 -13
- data/lib/zmq/version.rb +1 -1
- data/rbczmq.gemspec +1 -0
- data/test/helper.rb +2 -4
- data/test/test_beacon.rb +14 -26
- data/test/test_context.rb +2 -2
- data/test/test_frame.rb +2 -2
- data/test/test_logger.rb +15 -18
- data/test/test_message.rb +4 -4
- data/test/test_socket.rb +2 -3
- data/test/test_threading.rb +2 -2
- data/test/test_zmq.rb +6 -0
- metadata +120 -107
- data/ext/rbczmq/ruby19.h +0 -4
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ODVlN2VkYTUxOTMyOWQ5MTBhMzJkNWZhM2JjNDAxODRkNzc2ODk4Yw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 01f7a617098dab8cb3800f01bd8a4c24af8aaedf
|
4
|
+
data.tar.gz: 701f90292c7bfd1ca2ff846ce6388e43e5350868
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
YTFiMzg4ZGNkMzRjZTRmNTIwMzQ1NzJlYmYyZjU2NjdlZjRiNDJhZmJiNGFl
|
11
|
-
MTBjNzBhMmUxZjNjZTZjMGU3OWQxYjg0ZWZhOTJkYjM4NDM2NzM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZTk1NTgzMjU1NTM4ZmQ3ZDdkYWE2OWYyMjgyYmIwZTFlM2MxZWFlNzAxYTA2
|
14
|
-
OWNjZTRlZmM5ZWExNzg3MTI5MTY3NjRlNWQyYjNjNTM3NWNlYTQ3MDc3OTZk
|
15
|
-
M2NlMWRjN2JhYzg4MmMwY2M3YmU3NGQ5ODc2NTRkM2U4YTg5YjI=
|
6
|
+
metadata.gz: b8bef93adec081ac3039a90ab3fb6387c2873ae48ece830c10e66cbadf2abac2f67cf63271783045a9329bfa8796ddcc94b3b11353e4f095a5cf78fc6a2d4b6b
|
7
|
+
data.tar.gz: bb85824630315a6f89d16609649f2c1f97ae34ba46db847cee43594ceafc4ff2add9fb0a7b64d87f8dfd780726d985061093bb0282c142b901ef0261a9cd519c
|
data/.travis.yml
CHANGED
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
= Changelog
|
2
2
|
|
3
|
+
== 1.7.8 (December 24, 2014)
|
4
|
+
|
5
|
+
* clean up beacon tests to bind to port 0 to get an automatically assigned free port (Erkki Eilonen)
|
6
|
+
* Support rubies > 2.1
|
7
|
+
|
3
8
|
== 1.7.7 (August 29, 2014)
|
4
9
|
|
5
10
|
* Add the ability to use system libraries for hosts that already have libzmq and libczmq installed by passing the
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,20 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rbczmq (1.7.
|
4
|
+
rbczmq (1.7.8)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
ffi2-generators (0.1.1)
|
10
10
|
json (1.8.1)
|
11
|
-
minitest (
|
12
|
-
rake (10.
|
11
|
+
minitest (5.5.0)
|
12
|
+
rake (10.4.2)
|
13
13
|
rake-compiler (0.8.3)
|
14
14
|
rake
|
15
|
-
|
15
|
+
rb-readline (0.5.1)
|
16
|
+
rdoc (4.2.0)
|
16
17
|
json (~> 1.4)
|
17
|
-
rubysl (2.0
|
18
|
+
rubysl (2.1.0)
|
18
19
|
rubysl-abbrev (~> 2.0)
|
19
20
|
rubysl-base64 (~> 2.0)
|
20
21
|
rubysl-benchmark (~> 2.0)
|
@@ -48,7 +49,7 @@ GEM
|
|
48
49
|
rubysl-io-nonblock (~> 2.0)
|
49
50
|
rubysl-io-wait (~> 2.0)
|
50
51
|
rubysl-ipaddr (~> 2.0)
|
51
|
-
rubysl-irb (~> 2.
|
52
|
+
rubysl-irb (~> 2.1)
|
52
53
|
rubysl-logger (~> 2.0)
|
53
54
|
rubysl-mathn (~> 2.0)
|
54
55
|
rubysl-matrix (~> 2.0)
|
@@ -77,7 +78,6 @@ GEM
|
|
77
78
|
rubysl-pstore (~> 2.0)
|
78
79
|
rubysl-pty (~> 2.0)
|
79
80
|
rubysl-rational (~> 2.0)
|
80
|
-
rubysl-readline (~> 2.0)
|
81
81
|
rubysl-resolv (~> 2.0)
|
82
82
|
rubysl-rexml (~> 2.0)
|
83
83
|
rubysl-rinda (~> 2.0)
|
@@ -119,14 +119,14 @@ GEM
|
|
119
119
|
rubysl-csv (2.0.2)
|
120
120
|
rubysl-english (~> 2.0)
|
121
121
|
rubysl-curses (2.0.1)
|
122
|
-
rubysl-date (2.0.
|
122
|
+
rubysl-date (2.0.8)
|
123
123
|
rubysl-delegate (2.0.1)
|
124
124
|
rubysl-digest (2.0.3)
|
125
125
|
rubysl-drb (2.0.1)
|
126
126
|
rubysl-e2mmap (2.0.0)
|
127
127
|
rubysl-english (2.0.0)
|
128
128
|
rubysl-enumerator (2.0.0)
|
129
|
-
rubysl-erb (2.0.
|
129
|
+
rubysl-erb (2.0.2)
|
130
130
|
rubysl-etc (2.0.3)
|
131
131
|
ffi2-generators (~> 0.1)
|
132
132
|
rubysl-expect (2.0.0)
|
@@ -144,12 +144,12 @@ GEM
|
|
144
144
|
rubysl-io-nonblock (2.0.0)
|
145
145
|
rubysl-io-wait (2.0.0)
|
146
146
|
rubysl-ipaddr (2.0.0)
|
147
|
-
rubysl-irb (2.0
|
147
|
+
rubysl-irb (2.1.0)
|
148
|
+
rb-readline (~> 0.5)
|
148
149
|
rubysl-e2mmap (~> 2.0)
|
149
150
|
rubysl-mathn (~> 2.0)
|
150
|
-
rubysl-readline (~> 2.0)
|
151
151
|
rubysl-thread (~> 2.0)
|
152
|
-
rubysl-logger (2.
|
152
|
+
rubysl-logger (2.1.0)
|
153
153
|
rubysl-mathn (2.0.0)
|
154
154
|
rubysl-matrix (2.1.0)
|
155
155
|
rubysl-e2mmap (~> 2.0)
|
@@ -172,22 +172,21 @@ GEM
|
|
172
172
|
rubysl-observer (2.0.0)
|
173
173
|
rubysl-open-uri (2.0.0)
|
174
174
|
rubysl-open3 (2.0.0)
|
175
|
-
rubysl-openssl (2.
|
175
|
+
rubysl-openssl (2.2.1)
|
176
176
|
rubysl-optparse (2.0.1)
|
177
177
|
rubysl-shellwords (~> 2.0)
|
178
178
|
rubysl-ostruct (2.0.4)
|
179
|
-
rubysl-pathname (2.
|
180
|
-
rubysl-prettyprint (2.0.
|
179
|
+
rubysl-pathname (2.1.0)
|
180
|
+
rubysl-prettyprint (2.0.3)
|
181
181
|
rubysl-prime (2.0.1)
|
182
182
|
rubysl-profile (2.0.0)
|
183
183
|
rubysl-profiler (2.0.1)
|
184
184
|
rubysl-pstore (2.0.0)
|
185
|
-
rubysl-pty (2.0.
|
185
|
+
rubysl-pty (2.0.3)
|
186
186
|
rubysl-rational (2.0.1)
|
187
|
-
rubysl-
|
188
|
-
rubysl-
|
189
|
-
rubysl-
|
190
|
-
rubysl-rinda (2.0.0)
|
187
|
+
rubysl-resolv (2.1.0)
|
188
|
+
rubysl-rexml (2.0.4)
|
189
|
+
rubysl-rinda (2.0.1)
|
191
190
|
rubysl-rss (2.0.0)
|
192
191
|
rubysl-scanf (2.0.0)
|
193
192
|
rubysl-securerandom (2.0.0)
|
@@ -198,16 +197,14 @@ GEM
|
|
198
197
|
rubysl-stringio (2.0.0)
|
199
198
|
rubysl-strscan (2.0.0)
|
200
199
|
rubysl-sync (2.0.0)
|
201
|
-
rubysl-syslog (2.0
|
200
|
+
rubysl-syslog (2.1.0)
|
202
201
|
ffi2-generators (~> 0.1)
|
203
202
|
rubysl-tempfile (2.0.1)
|
204
|
-
rubysl-test-unit (2.0.3)
|
205
|
-
minitest (~> 4.7)
|
206
203
|
rubysl-thread (2.0.2)
|
207
204
|
rubysl-thwait (2.0.0)
|
208
205
|
rubysl-time (2.0.3)
|
209
206
|
rubysl-timeout (2.0.0)
|
210
|
-
rubysl-tmpdir (2.0.
|
207
|
+
rubysl-tmpdir (2.0.1)
|
211
208
|
rubysl-tsort (2.0.1)
|
212
209
|
rubysl-un (2.0.0)
|
213
210
|
rubysl-fileutils (~> 2.0)
|
@@ -223,10 +220,9 @@ PLATFORMS
|
|
223
220
|
ruby
|
224
221
|
|
225
222
|
DEPENDENCIES
|
226
|
-
minitest (~>
|
223
|
+
minitest (~> 5.5.0)
|
227
224
|
rake
|
228
225
|
rake-compiler (~> 0.8.0)
|
229
226
|
rbczmq!
|
230
227
|
rdoc
|
231
228
|
rubysl (~> 2.0)
|
232
|
-
rubysl-test-unit (~> 2.0)
|
data/Rakefile
CHANGED
data/ext/rbczmq/beacon.c
CHANGED
@@ -24,7 +24,7 @@ static void rb_czmq_free_beacon_gc(void *ptr)
|
|
24
24
|
{
|
25
25
|
zmq_beacon_wrapper *beacon = (zmq_beacon_wrapper *)ptr;
|
26
26
|
if (beacon) {
|
27
|
-
|
27
|
+
rb_thread_call_without_gvl(rb_czmq_nogvl_beacon_destroy, beacon, RUBY_UBF_IO, 0);
|
28
28
|
xfree(beacon);
|
29
29
|
}
|
30
30
|
}
|
@@ -57,7 +57,7 @@ static VALUE rb_czmq_beacon_s_new(VALUE beacon, VALUE port)
|
|
57
57
|
Check_Type(port, T_FIXNUM);
|
58
58
|
beacon = Data_Make_Struct(rb_cZmqBeacon, zmq_beacon_wrapper, 0, rb_czmq_free_beacon_gc, bcn);
|
59
59
|
prt = FIX2INT(port);
|
60
|
-
bcn->beacon = (zbeacon_t*)
|
60
|
+
bcn->beacon = (zbeacon_t*)rb_thread_call_without_gvl(rb_czmq_nogvl_new_beacon, (void *)prt, RUBY_UBF_IO, 0);
|
61
61
|
ZmqAssertObjOnAlloc(bcn->beacon, bcn);
|
62
62
|
rb_obj_call_init(beacon, 0, NULL);
|
63
63
|
return beacon;
|
@@ -77,7 +77,7 @@ static VALUE rb_czmq_beacon_s_new(VALUE beacon, VALUE port)
|
|
77
77
|
static VALUE rb_czmq_beacon_destroy(VALUE obj)
|
78
78
|
{
|
79
79
|
GetZmqBeacon(obj);
|
80
|
-
|
80
|
+
rb_thread_call_without_gvl(rb_czmq_nogvl_beacon_destroy, beacon, RUBY_UBF_IO, 0);
|
81
81
|
return Qnil;
|
82
82
|
}
|
83
83
|
|
@@ -127,7 +127,7 @@ static VALUE rb_czmq_beacon_set_interval(VALUE obj, VALUE interval)
|
|
127
127
|
Check_Type(interval, T_FIXNUM);
|
128
128
|
args.beacon = beacon;
|
129
129
|
args.interval = FIX2INT(interval);
|
130
|
-
|
130
|
+
rb_thread_call_without_gvl(rb_czmq_nogvl_set_interval, (void *)&args, RUBY_UBF_IO, 0);
|
131
131
|
return Qnil;
|
132
132
|
}
|
133
133
|
|
@@ -156,7 +156,7 @@ static VALUE rb_czmq_nogvl_noecho(void *ptr)
|
|
156
156
|
static VALUE rb_czmq_beacon_noecho(VALUE obj)
|
157
157
|
{
|
158
158
|
GetZmqBeacon(obj);
|
159
|
-
|
159
|
+
rb_thread_call_without_gvl(rb_czmq_nogvl_noecho, (void *)beacon, RUBY_UBF_IO, 0);
|
160
160
|
return Qnil;
|
161
161
|
}
|
162
162
|
|
@@ -191,7 +191,7 @@ static VALUE rb_czmq_beacon_publish(VALUE obj, VALUE transmit)
|
|
191
191
|
args.beacon = beacon;
|
192
192
|
args.transmit = RSTRING_PTR(transmit);
|
193
193
|
args.length = (int)RSTRING_LEN(transmit);
|
194
|
-
|
194
|
+
rb_thread_call_without_gvl(rb_czmq_nogvl_publish, (void *)&args, RUBY_UBF_IO, 0);
|
195
195
|
return Qnil;
|
196
196
|
}
|
197
197
|
|
@@ -220,7 +220,7 @@ static VALUE rb_czmq_nogvl_silence(void *ptr)
|
|
220
220
|
static VALUE rb_czmq_beacon_silence(VALUE obj)
|
221
221
|
{
|
222
222
|
GetZmqBeacon(obj);
|
223
|
-
|
223
|
+
rb_thread_call_without_gvl(rb_czmq_nogvl_silence, (void *)beacon, RUBY_UBF_IO, 0);
|
224
224
|
return Qnil;
|
225
225
|
}
|
226
226
|
|
@@ -260,7 +260,7 @@ static VALUE rb_czmq_beacon_subscribe(VALUE obj, VALUE filter)
|
|
260
260
|
args.filter = RSTRING_PTR(filter);
|
261
261
|
args.length = (int)RSTRING_LEN(filter);
|
262
262
|
}
|
263
|
-
|
263
|
+
rb_thread_call_without_gvl(rb_czmq_nogvl_subscribe, (void *)&args, RUBY_UBF_IO, 0);
|
264
264
|
return Qnil;
|
265
265
|
}
|
266
266
|
|
@@ -289,7 +289,7 @@ static VALUE rb_czmq_nogvl_unsubscribe(void *ptr)
|
|
289
289
|
static VALUE rb_czmq_beacon_unsubscribe(VALUE obj)
|
290
290
|
{
|
291
291
|
GetZmqBeacon(obj);
|
292
|
-
|
292
|
+
rb_thread_call_without_gvl(rb_czmq_nogvl_unsubscribe, (void *)beacon, RUBY_UBF_IO, 0);
|
293
293
|
return Qnil;
|
294
294
|
}
|
295
295
|
|
data/ext/rbczmq/context.c
CHANGED
@@ -54,7 +54,7 @@ static void rb_czmq_free_ctx(zmq_ctx_wrapper *ctx)
|
|
54
54
|
}
|
55
55
|
|
56
56
|
// finally, shutdown the context.
|
57
|
-
|
57
|
+
rb_thread_call_without_gvl(rb_czmq_nogvl_zctx_destroy, (void *)ctx, RUBY_UBF_IO, 0);
|
58
58
|
|
59
59
|
ctx->ctx = NULL;
|
60
60
|
rb_hash_aset(ctx_map, ctx->pidValue, Qnil);
|
@@ -108,7 +108,7 @@ void rb_czmq_context_destroy_socket(zmq_sock_wrapper* socket)
|
|
108
108
|
zlist_remove(ctx->sockets, socket);
|
109
109
|
|
110
110
|
if (socket->socket) {
|
111
|
-
|
111
|
+
rb_thread_call_without_gvl(rb_czmq_nogvl_zsocket_destroy, (void *)socket, RUBY_UBF_IO, 0);
|
112
112
|
}
|
113
113
|
}
|
114
114
|
}
|
@@ -178,19 +178,26 @@ static VALUE rb_czmq_nogvl_zctx_new(ZMQ_UNUSED void *ptr)
|
|
178
178
|
|
179
179
|
static VALUE rb_czmq_ctx_s_new(int argc, VALUE *argv, VALUE context)
|
180
180
|
{
|
181
|
+
VALUE process_ctx;
|
181
182
|
VALUE ctx_map;
|
182
183
|
VALUE io_threads;
|
183
184
|
zmq_ctx_wrapper *ctx = NULL;
|
184
185
|
rb_scan_args(argc, argv, "01", &io_threads);
|
185
186
|
ctx_map = rb_ivar_get(rb_mZmq, intern_zctx_process);
|
186
|
-
|
187
|
+
process_ctx = rb_hash_aref(ctx_map, get_pid());
|
188
|
+
if (!NIL_P(process_ctx)){
|
189
|
+
Data_Get_Struct(process_ctx, zmq_ctx_wrapper, ctx);
|
190
|
+
rb_raise(rb_eZmqError, "single ZMQ context per process allowed (previous context created at %s:%d)", ctx->file, ctx->line);
|
191
|
+
}
|
187
192
|
context = Data_Make_Struct(rb_cZmqContext, zmq_ctx_wrapper, rb_czmq_mark_ctx_gc, rb_czmq_free_ctx_gc, ctx);
|
188
|
-
ctx->ctx = (zctx_t*)
|
193
|
+
ctx->ctx = (zctx_t*)rb_thread_call_without_gvl(rb_czmq_nogvl_zctx_new, NULL, RUBY_UBF_IO, 0);
|
189
194
|
ZmqAssertObjOnAlloc(ctx->ctx, ctx);
|
190
195
|
ctx->flags = 0;
|
191
196
|
ctx->pid = getpid();
|
192
197
|
ctx->pidValue = get_pid();
|
193
198
|
ctx->sockets = zlist_new();
|
199
|
+
ctx->file = rb_sourcefile();
|
200
|
+
ctx->line = rb_sourceline();
|
194
201
|
rb_obj_call_init(context, 0, NULL);
|
195
202
|
rb_hash_aset(ctx_map, ctx->pidValue, context);
|
196
203
|
if (!NIL_P(io_threads)) rb_czmq_ctx_set_iothreads(context, io_threads);
|
@@ -372,6 +379,7 @@ static VALUE rb_czmq_ctx_socket(VALUE obj, VALUE type)
|
|
372
379
|
int socket_type;
|
373
380
|
struct nogvl_socket_args args;
|
374
381
|
errno = 0;
|
382
|
+
void *socket;
|
375
383
|
ZmqGetContext(obj);
|
376
384
|
ZmqAssertContextPidMatches(ctx);
|
377
385
|
if (TYPE(type) != T_FIXNUM && TYPE(type) != T_SYMBOL) rb_raise(rb_eTypeError, "wrong socket type %s (expected Fixnum or Symbol)", RSTRING_PTR(rb_obj_as_string(type)));
|
@@ -379,7 +387,8 @@ static VALUE rb_czmq_ctx_socket(VALUE obj, VALUE type)
|
|
379
387
|
|
380
388
|
args.ctx = ctx->ctx;
|
381
389
|
args.type = socket_type;
|
382
|
-
|
390
|
+
socket = rb_thread_call_without_gvl(rb_czmq_nogvl_socket_new, (void *)&args, RUBY_UBF_IO, 0);
|
391
|
+
VALUE socket_object = rb_czmq_socket_alloc(obj, ctx->ctx, socket);
|
383
392
|
zmq_sock_wrapper *sock = NULL;
|
384
393
|
GetZmqSocket(socket_object);
|
385
394
|
zlist_push(ctx->sockets, sock);
|
data/ext/rbczmq/context.h
CHANGED
@@ -10,6 +10,8 @@ typedef struct {
|
|
10
10
|
int flags;
|
11
11
|
pid_t pid; /* this is the pid for the process that created the context. Only this process can use the context. */
|
12
12
|
VALUE pidValue; /* this is the key used to ensure one context per process */
|
13
|
+
const char *file; /* Source file where the context for this process was created */
|
14
|
+
int line; /* Source line where the context for this process was created */
|
13
15
|
zlist_t* sockets; /* list of socket wrapper objects owned by this context. */
|
14
16
|
} zmq_ctx_wrapper;
|
15
17
|
|
data/ext/rbczmq/extconf.rb
CHANGED
@@ -124,7 +124,9 @@ end
|
|
124
124
|
|
125
125
|
dir_config('rbczmq')
|
126
126
|
|
127
|
+
have_header('ruby/thread.h')
|
127
128
|
have_func('rb_thread_blocking_region')
|
129
|
+
have_func('rb_thread_call_without_gvl')
|
128
130
|
|
129
131
|
$INCFLAGS << " -I#{zmq_include_path}" if find_header("zmq.h", zmq_include_path)
|
130
132
|
$INCFLAGS << " -I#{czmq_include_path}" if find_header("czmq.h", czmq_include_path)
|
data/ext/rbczmq/loop.c
CHANGED
@@ -301,7 +301,7 @@ static VALUE rb_czmq_loop_start(VALUE obj)
|
|
301
301
|
rb_thread_schedule();
|
302
302
|
zloop_timer(loop->loop, 1, 1, rb_czmq_loop_started_callback, loop);
|
303
303
|
|
304
|
-
rc = (int)
|
304
|
+
rc = (int)rb_thread_call_without_gvl(rb_czmq_loop_start_nogvl, (void *)loop, rb_czmq_loop_start_ubf, (void*)loop);
|
305
305
|
|
306
306
|
if (rc > 0) rb_raise(rb_eZmqError, "internal event loop error!");
|
307
307
|
return INT2NUM(rc);
|
data/ext/rbczmq/poller.c
CHANGED
@@ -157,7 +157,7 @@ VALUE rb_czmq_poller_poll(int argc, VALUE *argv, VALUE obj)
|
|
157
157
|
rb_ary_clear(poller->readables);
|
158
158
|
rb_ary_clear(poller->writables);
|
159
159
|
|
160
|
-
rc = (int)
|
160
|
+
rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_poll, (void *)&args, RUBY_UBF_IO, 0);
|
161
161
|
|
162
162
|
/* only call ZmqAssert if return code is less than zero since zmq_poll returns the number of pollers on success */
|
163
163
|
if (rc < 0) {
|
data/ext/rbczmq/rbczmq_ext.c
CHANGED
@@ -67,6 +67,22 @@ static VALUE rb_czmq_m_version(ZMQ_UNUSED VALUE obj)
|
|
67
67
|
return rb_ary_new3(3, INT2NUM(major), INT2NUM(minor), INT2NUM(patch));
|
68
68
|
}
|
69
69
|
|
70
|
+
/*
|
71
|
+
* call-seq:
|
72
|
+
* ZMQ.czmq_version => Array
|
73
|
+
*
|
74
|
+
* Returns the czmq version linked against.
|
75
|
+
*
|
76
|
+
* === Examples
|
77
|
+
* ZMQ.czmq_version => [3,0,0]
|
78
|
+
*
|
79
|
+
*/
|
80
|
+
|
81
|
+
static VALUE rb_czmq_m_czmq_version(ZMQ_UNUSED VALUE obj)
|
82
|
+
{
|
83
|
+
return rb_ary_new3(3, INT2NUM(CZMQ_VERSION_MAJOR), INT2NUM(CZMQ_VERSION_MINOR), INT2NUM(CZMQ_VERSION_PATCH));
|
84
|
+
}
|
85
|
+
|
70
86
|
/*
|
71
87
|
* call-seq:
|
72
88
|
* ZMQ.now => Fixnum
|
@@ -207,7 +223,7 @@ static VALUE rb_czmq_m_proxy(int argc, VALUE *argv, ZMQ_UNUSED VALUE klass)
|
|
207
223
|
sockets[2] = NULL;
|
208
224
|
}
|
209
225
|
|
210
|
-
rc = (int)
|
226
|
+
rc = (int)rb_thread_call_without_gvl(rb_czmq_m_proxy_nogvl, (void *)sockets, RUBY_UBF_IO, 0);
|
211
227
|
|
212
228
|
// int result = zmq_proxy(frontend_socket, backend_socket, capture_socket);
|
213
229
|
return INT2NUM(rc);
|
@@ -228,6 +244,7 @@ void Init_rbczmq_ext()
|
|
228
244
|
|
229
245
|
rb_define_module_function(rb_mZmq, "interrupted?", rb_czmq_m_interrupted_p, 0);
|
230
246
|
rb_define_module_function(rb_mZmq, "version", rb_czmq_m_version, 0);
|
247
|
+
rb_define_module_function(rb_mZmq, "czmq_version", rb_czmq_m_czmq_version, 0);
|
231
248
|
rb_define_module_function(rb_mZmq, "now", rb_czmq_m_now, 0);
|
232
249
|
rb_define_module_function(rb_mZmq, "log", rb_czmq_m_log, 1);
|
233
250
|
rb_define_module_function(rb_mZmq, "error", rb_czmq_m_error, 0);
|
data/ext/rbczmq/rbczmq_prelude.h
CHANGED
data/ext/rbczmq/ruby2.h
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#ifndef RBCZMQ_RUBY2_H
|
2
|
+
#define RBCZMQ_RUBY2_H
|
3
|
+
|
4
|
+
#ifdef HAVE_RUBY_THREAD_H
|
5
|
+
#include <ruby/thread.h>
|
6
|
+
#endif
|
7
|
+
|
8
|
+
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
9
|
+
#define rb_thread_call_without_gvl(func, data1, ubf, data2) \
|
10
|
+
rb_thread_blocking_region((rb_blocking_function_t *)func, data1, ubf, data2)
|
11
|
+
#endif
|
12
|
+
|
13
|
+
#endif
|
data/ext/rbczmq/socket.c
CHANGED
@@ -211,7 +211,7 @@ static VALUE rb_czmq_socket_bind(VALUE obj, VALUE endpoint)
|
|
211
211
|
Check_Type(endpoint, T_STRING);
|
212
212
|
args.socket = sock;
|
213
213
|
args.endpoint = StringValueCStr(endpoint);
|
214
|
-
rc = (int)
|
214
|
+
rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_socket_bind, (void *)&args, RUBY_UBF_IO, 0);
|
215
215
|
/* ZmqAssert will return false on any non-zero return code. Bind returns the port number */
|
216
216
|
if (rc < 0) {
|
217
217
|
ZmqAssert(rc);
|
@@ -252,7 +252,7 @@ static VALUE rb_czmq_socket_connect(VALUE obj, VALUE endpoint)
|
|
252
252
|
Check_Type(endpoint, T_STRING);
|
253
253
|
args.socket = sock;
|
254
254
|
args.endpoint = StringValueCStr(endpoint);
|
255
|
-
rc = (int)
|
255
|
+
rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_socket_connect, (void *)&args, RUBY_UBF_IO, 0);
|
256
256
|
ZmqAssert(rc);
|
257
257
|
/* get the endpoint name with any ephemeral ports filled in. */
|
258
258
|
char* endpoint_string = zsocket_last_endpoint(sock->socket);
|
@@ -306,7 +306,7 @@ static VALUE rb_czmq_socket_disconnect(VALUE obj, VALUE endpoint)
|
|
306
306
|
Check_Type(endpoint, T_STRING);
|
307
307
|
args.socket = sock;
|
308
308
|
args.endpoint = StringValueCStr(endpoint);
|
309
|
-
rc = (int)
|
309
|
+
rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_socket_disconnect, (void *)&args, RUBY_UBF_IO, 0);
|
310
310
|
ZmqAssert(rc);
|
311
311
|
if (sock->verbose)
|
312
312
|
zclock_log ("I: %s socket %p: disconnected \"%s\"", zsocket_type_str(sock->socket), obj, StringValueCStr(endpoint));
|
@@ -360,7 +360,7 @@ static VALUE rb_czmq_socket_unbind(VALUE obj, VALUE endpoint)
|
|
360
360
|
Check_Type(endpoint, T_STRING);
|
361
361
|
args.socket = sock;
|
362
362
|
args.endpoint = StringValueCStr(endpoint);
|
363
|
-
rc = (int)
|
363
|
+
rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_socket_unbind, (void *)&args, RUBY_UBF_IO, 0);
|
364
364
|
ZmqAssert(rc);
|
365
365
|
if (sock->verbose)
|
366
366
|
zclock_log ("I: %s socket %p: unbound \"%s\"", zsocket_type_str(sock->socket), obj, StringValueCStr(endpoint));
|
@@ -468,7 +468,7 @@ static VALUE rb_czmq_socket_send(VALUE obj, VALUE msg)
|
|
468
468
|
Check_Type(msg, T_STRING);
|
469
469
|
args.msg = RSTRING_PTR(msg);
|
470
470
|
args.length = RSTRING_LEN(msg);
|
471
|
-
rc = (int)
|
471
|
+
rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_zstr_send, (void *)&args, RUBY_UBF_IO, 0);
|
472
472
|
ZmqAssert(rc);
|
473
473
|
if (sock->verbose)
|
474
474
|
zclock_log ("I: %s socket %p: send \"%s\"", zsocket_type_str(sock->socket), obj, StringValueCStr(msg));
|
@@ -503,7 +503,7 @@ static VALUE rb_czmq_socket_sendm(VALUE obj, VALUE msg)
|
|
503
503
|
Check_Type(msg, T_STRING);
|
504
504
|
args.msg = RSTRING_PTR(msg);
|
505
505
|
args.length = RSTRING_LEN(msg);
|
506
|
-
rc = (int)
|
506
|
+
rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_zstr_sendm, (void *)&args, RUBY_UBF_IO, 0);
|
507
507
|
ZmqAssert(rc);
|
508
508
|
if (sock->verbose)
|
509
509
|
zclock_log ("I: %s socket %p: sendm \"%s\"", zsocket_type_str(sock->socket), sock->socket, StringValueCStr(msg));
|
@@ -555,7 +555,7 @@ static VALUE rb_czmq_socket_recv(VALUE obj)
|
|
555
555
|
args.socket = sock;
|
556
556
|
zmq_msg_init(&args.message);
|
557
557
|
|
558
|
-
int rc = (int)
|
558
|
+
int rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_recv, (void *)&args, RUBY_UBF_IO, 0);
|
559
559
|
if (rc < 0) {
|
560
560
|
zmq_msg_close(&args.message);
|
561
561
|
return Qnil;
|
@@ -677,7 +677,7 @@ static VALUE rb_czmq_socket_send_frame(int argc, VALUE *argv, VALUE obj)
|
|
677
677
|
args.socket = sock;
|
678
678
|
args.frame = frame->frame;
|
679
679
|
args.flags = flgs;
|
680
|
-
rc = (int)
|
680
|
+
rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_send_frame, (void *)&args, RUBY_UBF_IO, 0);
|
681
681
|
ZmqAssert(rc);
|
682
682
|
if ((flgs & ZFRAME_REUSE) == 0) {
|
683
683
|
/* frame has been destroyed, clear the owns flag */
|
@@ -730,7 +730,7 @@ static VALUE rb_czmq_socket_send_message(VALUE obj, VALUE message_obj)
|
|
730
730
|
if (sock->verbose) print_message = zmsg_dup(message->message);
|
731
731
|
args.socket = sock;
|
732
732
|
args.message = message->message;
|
733
|
-
|
733
|
+
rb_thread_call_without_gvl(rb_czmq_nogvl_send_message, (void *)&args, RUBY_UBF_IO, 0);
|
734
734
|
message->flags &= ~ZMQ_MESSAGE_OWNED;
|
735
735
|
if (sock->verbose) ZmqDumpMessage("send_message", print_message);
|
736
736
|
return Qnil;
|
@@ -774,7 +774,7 @@ static VALUE rb_czmq_socket_recv_frame(VALUE obj)
|
|
774
774
|
ZmqAssertSocketNotPending(sock, "can only receive on a bound or connected socket!");
|
775
775
|
ZmqSockGuardCrossThread(sock);
|
776
776
|
args.socket = sock;
|
777
|
-
frame = (zframe_t *)
|
777
|
+
frame = (zframe_t *)rb_thread_call_without_gvl(rb_czmq_nogvl_recv_frame, (void *)&args, RUBY_UBF_IO, 0);
|
778
778
|
if (frame == NULL) return Qnil;
|
779
779
|
if (sock->verbose) {
|
780
780
|
cur_time = rb_czmq_formatted_current_time();
|
@@ -852,7 +852,7 @@ static VALUE rb_czmq_socket_recv_message(VALUE obj)
|
|
852
852
|
ZmqAssertSocketNotPending(sock, "can only receive on a bound or connected socket!");
|
853
853
|
ZmqSockGuardCrossThread(sock);
|
854
854
|
args.socket = sock;
|
855
|
-
message = (zmsg_t *)
|
855
|
+
message = (zmsg_t *)rb_thread_call_without_gvl(rb_czmq_nogvl_recv_message, (void *)&args, RUBY_UBF_IO, 0);
|
856
856
|
if (message == NULL) return Qnil;
|
857
857
|
if (sock->verbose) ZmqDumpMessage("recv_message", message);
|
858
858
|
return rb_czmq_alloc_message(message);
|
@@ -894,7 +894,7 @@ static VALUE rb_czmq_socket_poll(VALUE obj, VALUE timeout)
|
|
894
894
|
ZmqSockGuardCrossThread(sock);
|
895
895
|
args.socket = sock;
|
896
896
|
args.timeout = FIX2INT(timeout);
|
897
|
-
readable = (bool)
|
897
|
+
readable = (bool)rb_thread_call_without_gvl(rb_czmq_nogvl_poll, (void *)&args, RUBY_UBF_IO, 0);
|
898
898
|
return (readable == true) ? Qtrue : Qfalse;
|
899
899
|
}
|
900
900
|
|
@@ -1788,7 +1788,7 @@ static VALUE rb_czmq_socket_monitor_thread(void *arg)
|
|
1788
1788
|
while (1) {
|
1789
1789
|
zmq_msg_init (&args.msg_event);
|
1790
1790
|
zmq_msg_init (&args.msg_endpoint);
|
1791
|
-
rc = (int)
|
1791
|
+
rc = (int)rb_thread_call_without_gvl(rb_czmq_nogvl_monitor_recv, (void *)&args, RUBY_UBF_IO, 0);
|
1792
1792
|
if (rc == -1 && (zmq_errno() == ETERM || zmq_errno() == ENOTSOCK || zmq_errno() == EINTR)) break;
|
1793
1793
|
if (rc == -1 && (sock->flags & ZMQ_SOCKET_DESTROYED)) break;
|
1794
1794
|
assert (rc != -1);
|
data/lib/zmq/version.rb
CHANGED
data/rbczmq.gemspec
CHANGED
@@ -19,6 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.test_files = `git ls-files test`.split("\n")
|
20
20
|
s.rdoc_options = ["--charset=UTF-8"]
|
21
21
|
s.require_paths = ["lib"]
|
22
|
+
s.add_development_dependency('minitest', '~> 5.5.0')
|
22
23
|
s.add_development_dependency('rake-compiler', '~> 0.8.0')
|
23
24
|
|
24
25
|
# get an array of submodule dirs by executing 'pwd' inside each submodule
|
data/test/helper.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require 'test/unit'
|
4
3
|
require 'zmq'
|
4
|
+
require 'minitest/autorun'
|
5
5
|
require 'stringio'
|
6
6
|
|
7
7
|
Thread.abort_on_exception = true
|
8
8
|
|
9
|
-
class ZmqTestCase < Test
|
10
|
-
undef_method :default_test if method_defined? :default_test
|
11
|
-
|
9
|
+
class ZmqTestCase < Minitest::Test
|
12
10
|
if ENV['STRESS_GC']
|
13
11
|
def setup
|
14
12
|
GC.stress = true
|
data/test/test_beacon.rb
CHANGED
@@ -6,23 +6,10 @@ require 'socket'
|
|
6
6
|
class TestZmqBeacon < ZmqTestCase
|
7
7
|
def setup
|
8
8
|
GC.start
|
9
|
-
r = Random.new
|
10
|
-
begin
|
11
|
-
# find a random port number that we are able to bind to, and use this port
|
12
|
-
# for the beacon tests.
|
13
|
-
udp = UDPSocket.new
|
14
|
-
@port = 10000 + r.rand(50000)
|
15
|
-
udp.bind('0.0.0.0', @port)
|
16
|
-
rescue Errno::EADDRINUSE
|
17
|
-
udp.close
|
18
|
-
retry
|
19
|
-
ensure
|
20
|
-
udp.close
|
21
|
-
end
|
22
9
|
end
|
23
10
|
|
24
11
|
def test_beacon
|
25
|
-
beacon = ZMQ::Beacon.new(
|
12
|
+
beacon = ZMQ::Beacon.new(0)
|
26
13
|
assert_instance_of ZMQ::Beacon, beacon
|
27
14
|
assert_nil beacon.destroy
|
28
15
|
assert_raises TypeError do
|
@@ -33,14 +20,14 @@ class TestZmqBeacon < ZmqTestCase
|
|
33
20
|
end
|
34
21
|
|
35
22
|
def test_hostname
|
36
|
-
beacon = ZMQ::Beacon.new(
|
23
|
+
beacon = ZMQ::Beacon.new(0)
|
37
24
|
assert_instance_of String, beacon.hostname
|
38
25
|
ensure
|
39
26
|
beacon.destroy
|
40
27
|
end
|
41
28
|
|
42
29
|
def test_set_interval
|
43
|
-
beacon = ZMQ::Beacon.new(
|
30
|
+
beacon = ZMQ::Beacon.new(0)
|
44
31
|
beacon.interval = 100
|
45
32
|
assert_raises TypeError do
|
46
33
|
beacon.interval = :invalid
|
@@ -50,14 +37,14 @@ class TestZmqBeacon < ZmqTestCase
|
|
50
37
|
end
|
51
38
|
|
52
39
|
def test_noecho
|
53
|
-
beacon = ZMQ::Beacon.new(
|
40
|
+
beacon = ZMQ::Beacon.new(0)
|
54
41
|
assert_nil beacon.noecho
|
55
42
|
ensure
|
56
43
|
beacon.destroy
|
57
44
|
end
|
58
45
|
|
59
46
|
def test_publish
|
60
|
-
beacon = ZMQ::Beacon.new(
|
47
|
+
beacon = ZMQ::Beacon.new(0)
|
61
48
|
assert_raises TypeError do
|
62
49
|
beacon.publish :invalid
|
63
50
|
end
|
@@ -68,7 +55,7 @@ class TestZmqBeacon < ZmqTestCase
|
|
68
55
|
end
|
69
56
|
|
70
57
|
def test_subscribe
|
71
|
-
beacon = ZMQ::Beacon.new(
|
58
|
+
beacon = ZMQ::Beacon.new(0)
|
72
59
|
assert_raises TypeError do
|
73
60
|
beacon.subscribe :invalid
|
74
61
|
end
|
@@ -80,7 +67,7 @@ class TestZmqBeacon < ZmqTestCase
|
|
80
67
|
|
81
68
|
def test_pipe
|
82
69
|
GC.start
|
83
|
-
beacon = ZMQ::Beacon.new(
|
70
|
+
beacon = ZMQ::Beacon.new(0)
|
84
71
|
assert_instance_of ZMQ::Socket::Pair, beacon.pipe
|
85
72
|
GC.start # check GC cycle with "detached" socket
|
86
73
|
ensure
|
@@ -89,17 +76,18 @@ class TestZmqBeacon < ZmqTestCase
|
|
89
76
|
|
90
77
|
def test_announce_lookup
|
91
78
|
ctx = ZMQ::Context.new
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
service_beacon.
|
79
|
+
rep = ctx.bind(:REP, "tcp://127.0.0.1:0")
|
80
|
+
# official ZRE port, don't know how to introspect beacon to get bound port
|
81
|
+
beacon_port = 5670
|
82
|
+
service_beacon = ZMQ::Beacon.new(beacon_port)
|
83
|
+
service_beacon.publish(rep.endpoint)
|
96
84
|
sleep(0.5)
|
97
|
-
client_beacon = ZMQ::Beacon.new(
|
85
|
+
client_beacon = ZMQ::Beacon.new(beacon_port)
|
98
86
|
client_beacon.subscribe("tcp")
|
99
87
|
client_beacon.pipe.rcvtimeo = 1000
|
100
88
|
sender_address = client_beacon.pipe.recv
|
101
89
|
client_address = client_beacon.pipe.recv
|
102
|
-
assert_equal
|
90
|
+
assert_equal rep.endpoint, client_address
|
103
91
|
req = ctx.connect(:REQ, client_address)
|
104
92
|
req.send "ping"
|
105
93
|
assert_equal "ping", rep.recv
|
data/test/test_context.rb
CHANGED
@@ -11,7 +11,7 @@ class TestZmqContext < ZmqTestCase
|
|
11
11
|
end
|
12
12
|
assert_equal ctx, ZMQ.context
|
13
13
|
ensure
|
14
|
-
|
14
|
+
ctx.destroy
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_destroyed_context
|
@@ -30,7 +30,7 @@ class TestZmqContext < ZmqTestCase
|
|
30
30
|
end
|
31
31
|
assert_equal ctx, ZMQ.context
|
32
32
|
ensure
|
33
|
-
|
33
|
+
ctx.destroy
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_iothreads
|
data/test/test_frame.rb
CHANGED
@@ -36,7 +36,7 @@ class TestZmqFrame < ZmqTestCase
|
|
36
36
|
def test_dup
|
37
37
|
frame = ZMQ::Frame("message")
|
38
38
|
dup_frame = frame.dup
|
39
|
-
|
39
|
+
assert_operator dup_frame.object_id, :!=, frame.object_id
|
40
40
|
assert_equal frame.data, dup_frame.data
|
41
41
|
end
|
42
42
|
|
@@ -54,7 +54,7 @@ class TestZmqFrame < ZmqTestCase
|
|
54
54
|
def test_equals
|
55
55
|
frame = ZMQ::Frame("message")
|
56
56
|
assert_equal frame, ZMQ::Frame("message")
|
57
|
-
|
57
|
+
assert_operator frame, :!=, ZMQ::Frame("msg")
|
58
58
|
end
|
59
59
|
|
60
60
|
def test_compare
|
data/test/test_logger.rb
CHANGED
@@ -3,39 +3,36 @@
|
|
3
3
|
require File.expand_path("../helper.rb", __FILE__)
|
4
4
|
|
5
5
|
class TestZmqLogger < ZmqTestCase
|
6
|
-
|
7
|
-
def setup
|
8
|
-
@ctx = ZMQ::Context.new
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown
|
12
|
-
@ctx.destroy
|
13
|
-
end
|
14
|
-
|
15
6
|
def test_invalid_socket
|
16
|
-
|
7
|
+
ctx = ZMQ::Context.new
|
8
|
+
socket = ctx.socket(ZMQ::REQ)
|
17
9
|
assert_raises ZMQ::Logger::InvalidSocketError do
|
18
10
|
ZMQ::Logger.new(socket)
|
19
11
|
end
|
12
|
+
ensure
|
13
|
+
ctx.destroy
|
20
14
|
end
|
21
15
|
|
22
16
|
def test_valid_socket
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
17
|
+
ctx = ZMQ::Context.new
|
18
|
+
socket = ctx.socket(ZMQ::PUSH)
|
19
|
+
assert ZMQ::Logger.new(socket)
|
20
|
+
ensure
|
21
|
+
ctx.destroy
|
27
22
|
end
|
28
23
|
|
29
24
|
def test_send_message
|
30
|
-
|
25
|
+
ctx = ZMQ::Context.new
|
26
|
+
reader = ctx.socket(ZMQ::PULL)
|
31
27
|
port = reader.bind("tcp://*:*")
|
32
28
|
assert port > 0
|
33
|
-
writer =
|
29
|
+
writer = ctx.socket(ZMQ::PUSH)
|
34
30
|
writer.connect("tcp://localhost:#{port}")
|
35
31
|
logger = ZMQ::Logger.new(writer)
|
36
32
|
assert logger.debug("hellö world")
|
37
33
|
message = reader.recv.force_encoding Encoding::UTF_8
|
38
|
-
|
34
|
+
assert message =~ /hellö world/
|
35
|
+
ensure
|
36
|
+
ctx.destroy
|
39
37
|
end
|
40
|
-
|
41
38
|
end
|
data/test/test_message.rb
CHANGED
@@ -11,7 +11,7 @@ class TestZmqMessage < ZmqTestCase
|
|
11
11
|
|
12
12
|
def test_destroyed
|
13
13
|
msg = ZMQ::Message("one", "two")
|
14
|
-
|
14
|
+
assert msg.encode
|
15
15
|
assert !msg.gone?
|
16
16
|
msg.destroy
|
17
17
|
assert msg.gone?
|
@@ -162,7 +162,7 @@ class TestZmqMessage < ZmqTestCase
|
|
162
162
|
msg = ZMQ::Message.new
|
163
163
|
msg.pushstr "header"
|
164
164
|
dup_msg = msg.dup
|
165
|
-
|
165
|
+
assert_operator dup_msg.object_id, :!=, msg.object_id
|
166
166
|
assert_equal msg.size, dup_msg.size
|
167
167
|
assert_equal "header", msg.popstr
|
168
168
|
end
|
@@ -195,7 +195,7 @@ class TestZmqMessage < ZmqTestCase
|
|
195
195
|
other.pushstr "header"
|
196
196
|
other.pushstr "body"
|
197
197
|
|
198
|
-
|
198
|
+
assert_operator msg, :!=, other
|
199
199
|
assert !msg.eql?(other)
|
200
200
|
assert other.eql?(other)
|
201
201
|
end
|
@@ -244,7 +244,7 @@ class TestZmqMessage < ZmqTestCase
|
|
244
244
|
msg.add ZMQ::Frame.new("world")
|
245
245
|
push.send_message(msg)
|
246
246
|
received = pull.recv_message
|
247
|
-
|
247
|
+
assert received
|
248
248
|
assert_equal 2, received.size
|
249
249
|
assert_equal "hello", received.first.data
|
250
250
|
assert_equal "world", received.next.data
|
data/test/test_socket.rb
CHANGED
@@ -124,9 +124,8 @@ class TestZmqSocket < ZmqTestCase
|
|
124
124
|
assert sock.fd != -1
|
125
125
|
assert(sock.state & ZMQ::Socket::BOUND)
|
126
126
|
tcp_sock = nil
|
127
|
-
|
128
|
-
|
129
|
-
end
|
127
|
+
tcp_sock = TCPSocket.new("127.0.0.1", port)
|
128
|
+
assert tcp_sock
|
130
129
|
ensure
|
131
130
|
ctx.destroy
|
132
131
|
tcp_sock.close if tcp_sock
|
data/test/test_threading.rb
CHANGED
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
require File.expand_path("../helper.rb", __FILE__)
|
4
4
|
|
5
|
-
Thread.abort_on_exception = true
|
6
|
-
|
7
5
|
class TestZmqThreading < ZmqTestCase
|
8
6
|
def test_threaded
|
9
7
|
ctx = ZMQ::Context.new
|
@@ -30,5 +28,7 @@ class TestZmqThreading < ZmqTestCase
|
|
30
28
|
threads.map!{|t| t.value }
|
31
29
|
thread_vals = [0, 1, 2, 3, 4, 500_000, 500_000, 500_000, 500_000, 500_000, expected, true]
|
32
30
|
assert_equal thread_vals, threads
|
31
|
+
ensure
|
32
|
+
ctx.destroy
|
33
33
|
end
|
34
34
|
end
|
data/test/test_zmq.rb
CHANGED
@@ -13,6 +13,12 @@ class TestZmq < ZmqTestCase
|
|
13
13
|
assert version.all?{|v| Fixnum === v }
|
14
14
|
end
|
15
15
|
|
16
|
+
def test_czmq_version
|
17
|
+
version = ZMQ.czmq_version
|
18
|
+
assert_instance_of Array, version
|
19
|
+
assert version.all?{|v| Fixnum === v }
|
20
|
+
end
|
21
|
+
|
16
22
|
def test_now
|
17
23
|
assert [Bignum, Fixnum].include?(ZMQ.now.class)
|
18
24
|
end
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lourens Naudé
|
@@ -10,20 +10,34 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-12-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: minitest
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 5.5.0
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 5.5.0
|
15
29
|
- !ruby/object:Gem::Dependency
|
16
30
|
name: rake-compiler
|
17
31
|
requirement: !ruby/object:Gem::Requirement
|
18
32
|
requirements:
|
19
|
-
- - ~>
|
33
|
+
- - "~>"
|
20
34
|
- !ruby/object:Gem::Version
|
21
35
|
version: 0.8.0
|
22
36
|
type: :development
|
23
37
|
prerelease: false
|
24
38
|
version_requirements: !ruby/object:Gem::Requirement
|
25
39
|
requirements:
|
26
|
-
- - ~>
|
40
|
+
- - "~>"
|
27
41
|
- !ruby/object:Gem::Version
|
28
42
|
version: 0.8.0
|
29
43
|
description: Ruby extension for ZeroMQ (ZMQ) using CZMQ - High-level C Binding for
|
@@ -37,9 +51,9 @@ extensions:
|
|
37
51
|
- ext/rbczmq/extconf.rb
|
38
52
|
extra_rdoc_files: []
|
39
53
|
files:
|
40
|
-
- .gitignore
|
41
|
-
- .gitmodules
|
42
|
-
- .travis.yml
|
54
|
+
- ".gitignore"
|
55
|
+
- ".gitmodules"
|
56
|
+
- ".travis.yml"
|
43
57
|
- CHANGELOG.rdoc
|
44
58
|
- Gemfile
|
45
59
|
- Gemfile.lock
|
@@ -51,101 +65,6 @@ files:
|
|
51
65
|
- examples/pub_sub.rb
|
52
66
|
- examples/push_pull.rb
|
53
67
|
- examples/req_rep.rb
|
54
|
-
- ext/rbczmq/beacon.c
|
55
|
-
- ext/rbczmq/beacon.h
|
56
|
-
- ext/rbczmq/context.c
|
57
|
-
- ext/rbczmq/context.h
|
58
|
-
- ext/rbczmq/extconf.rb
|
59
|
-
- ext/rbczmq/frame.c
|
60
|
-
- ext/rbczmq/frame.h
|
61
|
-
- ext/rbczmq/jruby.h
|
62
|
-
- ext/rbczmq/loop.c
|
63
|
-
- ext/rbczmq/loop.h
|
64
|
-
- ext/rbczmq/message.c
|
65
|
-
- ext/rbczmq/message.h
|
66
|
-
- ext/rbczmq/poller.c
|
67
|
-
- ext/rbczmq/poller.h
|
68
|
-
- ext/rbczmq/pollitem.c
|
69
|
-
- ext/rbczmq/pollitem.h
|
70
|
-
- ext/rbczmq/rbczmq_ext.c
|
71
|
-
- ext/rbczmq/rbczmq_ext.h
|
72
|
-
- ext/rbczmq/rbczmq_prelude.h
|
73
|
-
- ext/rbczmq/rubinius.h
|
74
|
-
- ext/rbczmq/ruby18.h
|
75
|
-
- ext/rbczmq/ruby19.h
|
76
|
-
- ext/rbczmq/socket.c
|
77
|
-
- ext/rbczmq/socket.h
|
78
|
-
- ext/rbczmq/timer.c
|
79
|
-
- ext/rbczmq/timer.h
|
80
|
-
- lib/rbczmq.rb
|
81
|
-
- lib/zmq.rb
|
82
|
-
- lib/zmq/context.rb
|
83
|
-
- lib/zmq/default_handler.rb
|
84
|
-
- lib/zmq/frame.rb
|
85
|
-
- lib/zmq/handler.rb
|
86
|
-
- lib/zmq/logger.rb
|
87
|
-
- lib/zmq/loop.rb
|
88
|
-
- lib/zmq/message.rb
|
89
|
-
- lib/zmq/monitor.rb
|
90
|
-
- lib/zmq/poller.rb
|
91
|
-
- lib/zmq/pollitem.rb
|
92
|
-
- lib/zmq/socket.rb
|
93
|
-
- lib/zmq/socket/dealer.rb
|
94
|
-
- lib/zmq/socket/pair.rb
|
95
|
-
- lib/zmq/socket/pub.rb
|
96
|
-
- lib/zmq/socket/pull.rb
|
97
|
-
- lib/zmq/socket/push.rb
|
98
|
-
- lib/zmq/socket/rep.rb
|
99
|
-
- lib/zmq/socket/req.rb
|
100
|
-
- lib/zmq/socket/router.rb
|
101
|
-
- lib/zmq/socket/stream.rb
|
102
|
-
- lib/zmq/socket/sub.rb
|
103
|
-
- lib/zmq/timer.rb
|
104
|
-
- lib/zmq/version.rb
|
105
|
-
- perf/pair.rb
|
106
|
-
- perf/pair/local.rb
|
107
|
-
- perf/pair/remote.rb
|
108
|
-
- perf/pub_sub.rb
|
109
|
-
- perf/pub_sub/local.rb
|
110
|
-
- perf/pub_sub/remote.rb
|
111
|
-
- perf/push_pull.rb
|
112
|
-
- perf/push_pull/local.rb
|
113
|
-
- perf/push_pull/remote.rb
|
114
|
-
- perf/req_rep.rb
|
115
|
-
- perf/req_rep/local.rb
|
116
|
-
- perf/req_rep/remote.rb
|
117
|
-
- perf/runner.rb
|
118
|
-
- rbczmq.gemspec
|
119
|
-
- test/helper.rb
|
120
|
-
- test/socket/test_dealer_socket.rb
|
121
|
-
- test/socket/test_pair_socket.rb
|
122
|
-
- test/socket/test_pair_sockets.rb
|
123
|
-
- test/socket/test_pub_socket.rb
|
124
|
-
- test/socket/test_pub_sub_sockets.rb
|
125
|
-
- test/socket/test_pull_socket.rb
|
126
|
-
- test/socket/test_push_pull_sockets.rb
|
127
|
-
- test/socket/test_push_socket.rb
|
128
|
-
- test/socket/test_rep_socket.rb
|
129
|
-
- test/socket/test_req_rep_sockets.rb
|
130
|
-
- test/socket/test_req_socket.rb
|
131
|
-
- test/socket/test_router_socket.rb
|
132
|
-
- test/socket/test_routing.rb
|
133
|
-
- test/socket/test_stream_socket.rb
|
134
|
-
- test/socket/test_sub_socket.rb
|
135
|
-
- test/test_beacon.rb
|
136
|
-
- test/test_context.rb
|
137
|
-
- test/test_frame.rb
|
138
|
-
- test/test_handler.rb
|
139
|
-
- test/test_logger.rb
|
140
|
-
- test/test_loop.rb
|
141
|
-
- test/test_message.rb
|
142
|
-
- test/test_monitoring.rb
|
143
|
-
- test/test_poller.rb
|
144
|
-
- test/test_pollitem.rb
|
145
|
-
- test/test_socket.rb
|
146
|
-
- test/test_threading.rb
|
147
|
-
- test/test_timer.rb
|
148
|
-
- test/test_zmq.rb
|
149
68
|
- ext/czmq/.gitignore
|
150
69
|
- ext/czmq/.travis.yml
|
151
70
|
- ext/czmq/AUTHORS
|
@@ -282,6 +201,32 @@ files:
|
|
282
201
|
- ext/czmq/src/zthread.c
|
283
202
|
- ext/czmq/src/ztree.c
|
284
203
|
- ext/czmq/version.sh
|
204
|
+
- ext/rbczmq/beacon.c
|
205
|
+
- ext/rbczmq/beacon.h
|
206
|
+
- ext/rbczmq/context.c
|
207
|
+
- ext/rbczmq/context.h
|
208
|
+
- ext/rbczmq/extconf.rb
|
209
|
+
- ext/rbczmq/frame.c
|
210
|
+
- ext/rbczmq/frame.h
|
211
|
+
- ext/rbczmq/jruby.h
|
212
|
+
- ext/rbczmq/loop.c
|
213
|
+
- ext/rbczmq/loop.h
|
214
|
+
- ext/rbczmq/message.c
|
215
|
+
- ext/rbczmq/message.h
|
216
|
+
- ext/rbczmq/poller.c
|
217
|
+
- ext/rbczmq/poller.h
|
218
|
+
- ext/rbczmq/pollitem.c
|
219
|
+
- ext/rbczmq/pollitem.h
|
220
|
+
- ext/rbczmq/rbczmq_ext.c
|
221
|
+
- ext/rbczmq/rbczmq_ext.h
|
222
|
+
- ext/rbczmq/rbczmq_prelude.h
|
223
|
+
- ext/rbczmq/rubinius.h
|
224
|
+
- ext/rbczmq/ruby18.h
|
225
|
+
- ext/rbczmq/ruby2.h
|
226
|
+
- ext/rbczmq/socket.c
|
227
|
+
- ext/rbczmq/socket.h
|
228
|
+
- ext/rbczmq/timer.c
|
229
|
+
- ext/rbczmq/timer.h
|
285
230
|
- ext/zeromq/.gitignore
|
286
231
|
- ext/zeromq/.hgeol
|
287
232
|
- ext/zeromq/.travis.yml
|
@@ -629,28 +574,97 @@ files:
|
|
629
574
|
- ext/zeromq/tools/Makefile.am
|
630
575
|
- ext/zeromq/tools/curve_keygen.c
|
631
576
|
- ext/zeromq/version.sh
|
577
|
+
- lib/rbczmq.rb
|
578
|
+
- lib/zmq.rb
|
579
|
+
- lib/zmq/context.rb
|
580
|
+
- lib/zmq/default_handler.rb
|
581
|
+
- lib/zmq/frame.rb
|
582
|
+
- lib/zmq/handler.rb
|
583
|
+
- lib/zmq/logger.rb
|
584
|
+
- lib/zmq/loop.rb
|
585
|
+
- lib/zmq/message.rb
|
586
|
+
- lib/zmq/monitor.rb
|
587
|
+
- lib/zmq/poller.rb
|
588
|
+
- lib/zmq/pollitem.rb
|
589
|
+
- lib/zmq/socket.rb
|
590
|
+
- lib/zmq/socket/dealer.rb
|
591
|
+
- lib/zmq/socket/pair.rb
|
592
|
+
- lib/zmq/socket/pub.rb
|
593
|
+
- lib/zmq/socket/pull.rb
|
594
|
+
- lib/zmq/socket/push.rb
|
595
|
+
- lib/zmq/socket/rep.rb
|
596
|
+
- lib/zmq/socket/req.rb
|
597
|
+
- lib/zmq/socket/router.rb
|
598
|
+
- lib/zmq/socket/stream.rb
|
599
|
+
- lib/zmq/socket/sub.rb
|
600
|
+
- lib/zmq/timer.rb
|
601
|
+
- lib/zmq/version.rb
|
602
|
+
- perf/pair.rb
|
603
|
+
- perf/pair/local.rb
|
604
|
+
- perf/pair/remote.rb
|
605
|
+
- perf/pub_sub.rb
|
606
|
+
- perf/pub_sub/local.rb
|
607
|
+
- perf/pub_sub/remote.rb
|
608
|
+
- perf/push_pull.rb
|
609
|
+
- perf/push_pull/local.rb
|
610
|
+
- perf/push_pull/remote.rb
|
611
|
+
- perf/req_rep.rb
|
612
|
+
- perf/req_rep/local.rb
|
613
|
+
- perf/req_rep/remote.rb
|
614
|
+
- perf/runner.rb
|
615
|
+
- rbczmq.gemspec
|
616
|
+
- test/helper.rb
|
617
|
+
- test/socket/test_dealer_socket.rb
|
618
|
+
- test/socket/test_pair_socket.rb
|
619
|
+
- test/socket/test_pair_sockets.rb
|
620
|
+
- test/socket/test_pub_socket.rb
|
621
|
+
- test/socket/test_pub_sub_sockets.rb
|
622
|
+
- test/socket/test_pull_socket.rb
|
623
|
+
- test/socket/test_push_pull_sockets.rb
|
624
|
+
- test/socket/test_push_socket.rb
|
625
|
+
- test/socket/test_rep_socket.rb
|
626
|
+
- test/socket/test_req_rep_sockets.rb
|
627
|
+
- test/socket/test_req_socket.rb
|
628
|
+
- test/socket/test_router_socket.rb
|
629
|
+
- test/socket/test_routing.rb
|
630
|
+
- test/socket/test_stream_socket.rb
|
631
|
+
- test/socket/test_sub_socket.rb
|
632
|
+
- test/test_beacon.rb
|
633
|
+
- test/test_context.rb
|
634
|
+
- test/test_frame.rb
|
635
|
+
- test/test_handler.rb
|
636
|
+
- test/test_logger.rb
|
637
|
+
- test/test_loop.rb
|
638
|
+
- test/test_message.rb
|
639
|
+
- test/test_monitoring.rb
|
640
|
+
- test/test_poller.rb
|
641
|
+
- test/test_pollitem.rb
|
642
|
+
- test/test_socket.rb
|
643
|
+
- test/test_threading.rb
|
644
|
+
- test/test_timer.rb
|
645
|
+
- test/test_zmq.rb
|
632
646
|
homepage: http://github.com/methodmissing/rbczmq
|
633
647
|
licenses:
|
634
648
|
- MIT
|
635
649
|
metadata: {}
|
636
650
|
post_install_message:
|
637
651
|
rdoc_options:
|
638
|
-
- --charset=UTF-8
|
652
|
+
- "--charset=UTF-8"
|
639
653
|
require_paths:
|
640
654
|
- lib
|
641
655
|
required_ruby_version: !ruby/object:Gem::Requirement
|
642
656
|
requirements:
|
643
|
-
- -
|
657
|
+
- - ">="
|
644
658
|
- !ruby/object:Gem::Version
|
645
659
|
version: '0'
|
646
660
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
647
661
|
requirements:
|
648
|
-
- -
|
662
|
+
- - ">="
|
649
663
|
- !ruby/object:Gem::Version
|
650
664
|
version: '0'
|
651
665
|
requirements: []
|
652
666
|
rubyforge_project:
|
653
|
-
rubygems_version: 2.
|
667
|
+
rubygems_version: 2.4.5
|
654
668
|
signing_key:
|
655
669
|
specification_version: 4
|
656
670
|
summary: Ruby extension for ZeroMQ (ZMQ) using CZMQ - High-level C Binding for ØMQ
|
@@ -686,4 +700,3 @@ test_files:
|
|
686
700
|
- test/test_threading.rb
|
687
701
|
- test/test_timer.rb
|
688
702
|
- test/test_zmq.rb
|
689
|
-
has_rdoc: true
|
data/ext/rbczmq/ruby19.h
DELETED