rbczmq 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +4 -0
- data/Gemfile.lock +1 -1
- data/ext/czmq.tar.gz +0 -0
- data/ext/rbczmq/context.c +1 -1
- data/ext/rbczmq/extconf.rb +1 -1
- data/ext/rbczmq/frame.c +1 -1
- data/ext/rbczmq/loop.c +10 -10
- data/ext/rbczmq/loop.h +2 -2
- data/ext/rbczmq/poller.c +9 -9
- data/ext/rbczmq/poller.h +2 -2
- data/ext/rbczmq/pollitem.c +2 -2
- data/ext/rbczmq/rbczmq_ext.c +1 -1
- data/ext/rbczmq/socket.c +4 -4
- data/ext/rbczmq/socket.h +4 -4
- data/ext/rbczmq/timer.c +3 -3
- data/ext/rbczmq/timer.h +1 -1
- data/lib/zmq/version.rb +1 -1
- metadata +37 -52
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
= Changelog
|
2
2
|
|
3
|
+
== 1.1 (April 4, 2012)
|
4
|
+
* Bump czmq to version 1.4.0
|
5
|
+
* Enable debug symbols for czmq in order to track down a GC bug with ZMQ::Message
|
6
|
+
|
3
7
|
== 1.0 (November 24, 2012)
|
4
8
|
* Supports ZeroMQ 3.2.2 (first stable and backwards compatible 3.x release)
|
5
9
|
* Monitoring API for handling socket state changes / events
|
data/Gemfile.lock
CHANGED
data/ext/czmq.tar.gz
CHANGED
Binary file
|
data/ext/rbczmq/context.c
CHANGED
@@ -301,7 +301,7 @@ static VALUE rb_czmq_ctx_socket(VALUE obj, VALUE type)
|
|
301
301
|
#endif
|
302
302
|
sock->flags = 0;
|
303
303
|
sock->ctx = ctx->ctx;
|
304
|
-
sock->verbose =
|
304
|
+
sock->verbose = false;
|
305
305
|
sock->state = ZMQ_SOCKET_PENDING;
|
306
306
|
sock->endpoints = rb_ary_new();
|
307
307
|
sock->thread = rb_thread_current();
|
data/ext/rbczmq/extconf.rb
CHANGED
data/ext/rbczmq/frame.c
CHANGED
@@ -232,7 +232,7 @@ static VALUE rb_czmq_frame_data_equals_p(VALUE obj, VALUE data)
|
|
232
232
|
{
|
233
233
|
ZmqGetFrame(obj);
|
234
234
|
Check_Type(data, T_STRING);
|
235
|
-
return (zframe_streq(frame, RSTRING_PTR(data)) ==
|
235
|
+
return (zframe_streq(frame, RSTRING_PTR(data)) == true) ? Qtrue : Qfalse;
|
236
236
|
}
|
237
237
|
|
238
238
|
/*
|
data/ext/rbczmq/loop.c
CHANGED
@@ -19,7 +19,7 @@ static VALUE rb_czmq_callback0(VALUE *args)
|
|
19
19
|
ZMQ_NOINLINE static int rb_czmq_loop_started_callback(ZMQ_UNUSED zloop_t *loop, ZMQ_UNUSED zmq_pollitem_t *item, void *arg)
|
20
20
|
{
|
21
21
|
zmq_loop_wrapper *loop_wrapper = arg;
|
22
|
-
loop_wrapper->running =
|
22
|
+
loop_wrapper->running = true;
|
23
23
|
return 0;
|
24
24
|
}
|
25
25
|
|
@@ -32,7 +32,7 @@ ZMQ_NOINLINE static int rb_czmq_loop_started_callback(ZMQ_UNUSED zloop_t *loop,
|
|
32
32
|
ZMQ_NOINLINE static int rb_czmq_loop_breaker_callback(ZMQ_UNUSED zloop_t *loop, ZMQ_UNUSED zmq_pollitem_t *item, void *arg)
|
33
33
|
{
|
34
34
|
zmq_loop_wrapper *loop_wrapper = arg;
|
35
|
-
loop_wrapper->running =
|
35
|
+
loop_wrapper->running = false;
|
36
36
|
return -1;
|
37
37
|
}
|
38
38
|
|
@@ -72,7 +72,7 @@ ZMQ_NOINLINE static int rb_czmq_loop_timer_callback(zloop_t *loop, ZMQ_UNUSED zm
|
|
72
72
|
int rc;
|
73
73
|
VALUE args[3];
|
74
74
|
ZmqGetTimer((VALUE)cb);
|
75
|
-
if (timer->cancelled ==
|
75
|
+
if (timer->cancelled == true) {
|
76
76
|
zloop_timer_end(loop, (void *)cb);
|
77
77
|
return 0;
|
78
78
|
}
|
@@ -163,8 +163,8 @@ static VALUE rb_czmq_loop_new(VALUE loop)
|
|
163
163
|
lp->loop = zloop_new();
|
164
164
|
ZmqAssertObjOnAlloc(lp->loop, lp);
|
165
165
|
lp->flags = 0;
|
166
|
-
lp->running =
|
167
|
-
lp->verbose =
|
166
|
+
lp->running = false;
|
167
|
+
lp->verbose = false;
|
168
168
|
rb_obj_call_init(loop, 0, NULL);
|
169
169
|
return loop;
|
170
170
|
}
|
@@ -209,7 +209,7 @@ static VALUE rb_czmq_loop_start(VALUE obj)
|
|
209
209
|
static VALUE rb_czmq_loop_running_p(VALUE obj)
|
210
210
|
{
|
211
211
|
ZmqGetLoop(obj);
|
212
|
-
return (loop->running ==
|
212
|
+
return (loop->running == true) ? Qtrue : Qfalse;
|
213
213
|
}
|
214
214
|
|
215
215
|
/*
|
@@ -238,7 +238,7 @@ static void rb_czmq_loop_stop0(zmq_loop_wrapper *loop)
|
|
238
238
|
static VALUE rb_czmq_loop_stop(VALUE obj)
|
239
239
|
{
|
240
240
|
ZmqGetLoop(obj);
|
241
|
-
if (loop->running ==
|
241
|
+
if (loop->running == false) rb_raise(rb_eZmqError, "event loop not running!");
|
242
242
|
rb_czmq_loop_stop0(loop);
|
243
243
|
return Qnil;
|
244
244
|
}
|
@@ -278,9 +278,9 @@ static VALUE rb_czmq_loop_destroy(VALUE obj)
|
|
278
278
|
|
279
279
|
static VALUE rb_czmq_loop_set_verbose(VALUE obj, VALUE level)
|
280
280
|
{
|
281
|
-
|
281
|
+
bool vlevel;
|
282
282
|
ZmqGetLoop(obj);
|
283
|
-
vlevel = (level == Qtrue) ?
|
283
|
+
vlevel = (level == Qtrue) ? true : false;
|
284
284
|
zloop_set_verbose(loop->loop, vlevel);
|
285
285
|
loop->verbose = vlevel;
|
286
286
|
return Qnil;
|
@@ -309,7 +309,7 @@ static VALUE rb_czmq_loop_register(VALUE obj, VALUE pollable)
|
|
309
309
|
rc = zloop_poller(loop->loop, pollitem->item, rb_czmq_loop_pollitem_callback, (void *)pollitem);
|
310
310
|
ZmqAssert(rc);
|
311
311
|
/* Let pollable be verbose if loop is verbose */
|
312
|
-
if (loop->verbose ==
|
312
|
+
if (loop->verbose == true) rb_czmq_pollitem_set_verbose(pollable, Qtrue);
|
313
313
|
return Qtrue;
|
314
314
|
}
|
315
315
|
|
data/ext/rbczmq/loop.h
CHANGED
data/ext/rbczmq/poller.c
CHANGED
@@ -47,7 +47,7 @@ int rb_czmq_poller_rebuild_pollset(zmq_poll_wrapper *poller)
|
|
47
47
|
ZmqGetPollitem(pollable);
|
48
48
|
poller->pollset[rebuilt] = *pollitem->item;
|
49
49
|
}
|
50
|
-
poller->dirty =
|
50
|
+
poller->dirty = false;
|
51
51
|
return 0;
|
52
52
|
}
|
53
53
|
|
@@ -93,8 +93,8 @@ VALUE rb_czmq_poller_new(VALUE obj)
|
|
93
93
|
poller->pollables = rb_ary_new();
|
94
94
|
poller->readables = rb_ary_new();
|
95
95
|
poller->writables = rb_ary_new();
|
96
|
-
poller->dirty =
|
97
|
-
poller->verbose =
|
96
|
+
poller->dirty = false;
|
97
|
+
poller->verbose = false;
|
98
98
|
rb_obj_call_init(obj, 0, NULL);
|
99
99
|
return obj;
|
100
100
|
}
|
@@ -143,7 +143,7 @@ VALUE rb_czmq_poller_poll(int argc, VALUE *argv, VALUE obj)
|
|
143
143
|
if (NIL_P(tmout)) tmout = INT2NUM(0);
|
144
144
|
if (TYPE(tmout) != T_FIXNUM && TYPE(tmout) != T_FLOAT) rb_raise(rb_eTypeError, "wrong timeout type %s (expected Fixnum or Float)", RSTRING_PTR(rb_obj_as_string(tmout)));
|
145
145
|
if (poller->poll_size == 0) return INT2NUM(0);
|
146
|
-
if (poller->dirty ==
|
146
|
+
if (poller->dirty == true) {
|
147
147
|
rc = rb_czmq_poller_rebuild_pollset(poller);
|
148
148
|
if (rc == -1) rb_raise(rb_eZmqError, "failed in rebuilding the pollset!");
|
149
149
|
}
|
@@ -193,10 +193,10 @@ VALUE rb_czmq_poller_register(VALUE obj, VALUE pollable)
|
|
193
193
|
pollable = rb_czmq_pollitem_coerce(pollable);
|
194
194
|
ZmqGetPollitem(pollable);
|
195
195
|
/* Let pollable item be verbose if poller is verbose */
|
196
|
-
if (poller->verbose ==
|
196
|
+
if (poller->verbose == true) rb_czmq_pollitem_set_verbose(pollable, Qtrue);
|
197
197
|
rb_ary_push(poller->pollables, pollable);
|
198
198
|
poller->poll_size++;
|
199
|
-
poller->dirty =
|
199
|
+
poller->dirty = true;
|
200
200
|
return pollable;
|
201
201
|
}
|
202
202
|
|
@@ -226,7 +226,7 @@ VALUE rb_czmq_poller_remove(VALUE obj, VALUE pollable)
|
|
226
226
|
if (pollable == rpollable || rb_czmq_pollitem_pollable(pollable) == rb_czmq_pollitem_pollable(rpollable)) {
|
227
227
|
rb_ary_delete(poller->pollables, rpollable);
|
228
228
|
poller->poll_size--;
|
229
|
-
poller->dirty =
|
229
|
+
poller->dirty = true;
|
230
230
|
return rpollable;
|
231
231
|
}
|
232
232
|
}
|
@@ -287,9 +287,9 @@ VALUE rb_czmq_poller_writables(VALUE obj)
|
|
287
287
|
|
288
288
|
static VALUE rb_czmq_poller_set_verbose(VALUE obj, VALUE level)
|
289
289
|
{
|
290
|
-
|
290
|
+
bool vlevel;
|
291
291
|
ZmqGetPoller(obj);
|
292
|
-
vlevel = (level == Qtrue) ?
|
292
|
+
vlevel = (level == Qtrue) ? true : false;
|
293
293
|
poller->verbose = vlevel;
|
294
294
|
return Qnil;
|
295
295
|
}
|
data/ext/rbczmq/poller.h
CHANGED
data/ext/rbczmq/pollitem.c
CHANGED
@@ -229,10 +229,10 @@ VALUE rb_czmq_pollitem_handler_equals(VALUE obj, VALUE handler)
|
|
229
229
|
|
230
230
|
VALUE rb_czmq_pollitem_set_verbose(VALUE obj, VALUE level)
|
231
231
|
{
|
232
|
-
|
232
|
+
bool vlevel;
|
233
233
|
zmq_sock_wrapper *sock = NULL;
|
234
234
|
ZmqGetPollitem(obj);
|
235
|
-
vlevel = (level == Qtrue) ?
|
235
|
+
vlevel = (level == Qtrue) ? true : false;
|
236
236
|
if (rb_obj_is_kind_of(pollitem->socket, rb_cZmqSocket)) {
|
237
237
|
GetZmqSocket(pollitem->socket);
|
238
238
|
sock->verbose = vlevel;
|
data/ext/rbczmq/rbczmq_ext.c
CHANGED
data/ext/rbczmq/socket.c
CHANGED
@@ -289,10 +289,10 @@ static VALUE rb_czmq_socket_connect(VALUE obj, VALUE endpoint)
|
|
289
289
|
|
290
290
|
static VALUE rb_czmq_socket_set_verbose(VALUE obj, VALUE level)
|
291
291
|
{
|
292
|
-
|
292
|
+
bool vlevel;
|
293
293
|
zmq_sock_wrapper *sock = NULL;
|
294
294
|
GetZmqSocket(obj);
|
295
|
-
vlevel = (level == Qtrue) ?
|
295
|
+
vlevel = (level == Qtrue) ? true : false;
|
296
296
|
sock->verbose = vlevel;
|
297
297
|
return Qnil;
|
298
298
|
}
|
@@ -310,10 +310,10 @@ static VALUE rb_czmq_nogvl_zstr_send(void *ptr)
|
|
310
310
|
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
311
311
|
return (VALUE)zstr_send(socket->socket, args->msg);
|
312
312
|
#else
|
313
|
-
if (rb_thread_alone()) return (VALUE)
|
313
|
+
if (rb_thread_alone()) return (VALUE)zstr_send(socket->socket, args->msg);
|
314
314
|
try_writable:
|
315
315
|
if ((zsocket_events(socket->socket) & ZMQ_POLLOUT) == ZMQ_POLLOUT) {
|
316
|
-
return (VALUE)
|
316
|
+
return (VALUE)zstr_send(socket->socket, args->msg);
|
317
317
|
} else {
|
318
318
|
rb_thread_wait_fd(zsocket_fd(socket->socket));
|
319
319
|
if (zsocket_sndtimeo(socket->socket) != -1)
|
data/ext/rbczmq/socket.h
CHANGED
@@ -13,7 +13,7 @@ typedef struct {
|
|
13
13
|
zctx_t *ctx;
|
14
14
|
void *socket;
|
15
15
|
int flags;
|
16
|
-
|
16
|
+
bool verbose;
|
17
17
|
int state;
|
18
18
|
#ifndef HAVE_RB_THREAD_BLOCKING_REGION
|
19
19
|
zlist_t *str_buffer;
|
@@ -106,20 +106,20 @@ void rb_czmq_free_sock_gc(void *ptr);
|
|
106
106
|
struct nogvl_send_args {
|
107
107
|
zmq_sock_wrapper *socket;
|
108
108
|
const char *msg;
|
109
|
-
|
109
|
+
bool read;
|
110
110
|
};
|
111
111
|
|
112
112
|
struct nogvl_send_frame_args {
|
113
113
|
zmq_sock_wrapper *socket;
|
114
114
|
zframe_t *frame;
|
115
115
|
int flags;
|
116
|
-
|
116
|
+
bool read;
|
117
117
|
};
|
118
118
|
|
119
119
|
struct nogvl_send_message_args {
|
120
120
|
zmq_sock_wrapper *socket;
|
121
121
|
zmsg_t *message;
|
122
|
-
|
122
|
+
bool read;
|
123
123
|
};
|
124
124
|
|
125
125
|
struct nogvl_recv_args {
|
data/ext/rbczmq/timer.c
CHANGED
@@ -49,7 +49,7 @@ VALUE rb_czmq_timer_s_new(int argc, VALUE *argv, VALUE timer)
|
|
49
49
|
Check_Type(times, T_FIXNUM);
|
50
50
|
timer_delay = (size_t)(((TYPE(delay) == T_FIXNUM) ? FIX2LONG(delay) : RFLOAT_VALUE(delay)) * 1000);
|
51
51
|
timer = Data_Make_Struct(rb_cZmqTimer, zmq_timer_wrapper, rb_czmq_mark_timer, rb_czmq_free_timer_gc, tr);
|
52
|
-
tr->cancelled =
|
52
|
+
tr->cancelled = false;
|
53
53
|
tr->delay = timer_delay;
|
54
54
|
tr->times = FIX2INT(times);
|
55
55
|
tr->callback = callback;
|
@@ -72,7 +72,7 @@ VALUE rb_czmq_timer_s_new(int argc, VALUE *argv, VALUE timer)
|
|
72
72
|
static VALUE rb_czmq_timer_fire(VALUE obj, VALUE args)
|
73
73
|
{
|
74
74
|
ZmqGetTimer(obj);
|
75
|
-
if (timer->cancelled ==
|
75
|
+
if (timer->cancelled == true) rb_raise(rb_eZmqError, "cannot fire timer, already cancelled!");
|
76
76
|
return rb_apply(timer->callback, intern_call, args);
|
77
77
|
}
|
78
78
|
|
@@ -91,7 +91,7 @@ static VALUE rb_czmq_timer_fire(VALUE obj, VALUE args)
|
|
91
91
|
static VALUE rb_czmq_timer_cancel(VALUE obj)
|
92
92
|
{
|
93
93
|
ZmqGetTimer(obj);
|
94
|
-
timer->cancelled =
|
94
|
+
timer->cancelled = true;
|
95
95
|
return Qnil;
|
96
96
|
}
|
97
97
|
|
data/ext/rbczmq/timer.h
CHANGED
data/lib/zmq/version.rb
CHANGED
metadata
CHANGED
@@ -1,49 +1,42 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbczmq
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.1'
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: "1.0"
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
12
|
-
-
|
7
|
+
authors:
|
8
|
+
- Lourens Naudé
|
13
9
|
- James Tucker
|
14
10
|
autorequire:
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2013-04-04 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
21
16
|
name: rake-compiler
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
24
18
|
none: false
|
25
|
-
requirements:
|
19
|
+
requirements:
|
26
20
|
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 63
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 8
|
32
|
-
- 0
|
21
|
+
- !ruby/object:Gem::Version
|
33
22
|
version: 0.8.0
|
34
23
|
type: :development
|
35
|
-
|
36
|
-
|
37
|
-
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ~>
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 0.8.0
|
31
|
+
description: Ruby extension for CZMQ - High-level C Binding for ØMQ (http://czmq.zeromq.org)
|
32
|
+
email:
|
38
33
|
- lourens@methodmissing.com
|
39
34
|
- jftucker@gmail.com
|
40
35
|
executables: []
|
41
|
-
|
42
|
-
extensions:
|
36
|
+
extensions:
|
43
37
|
- ext/rbczmq/extconf.rb
|
44
38
|
extra_rdoc_files: []
|
45
|
-
|
46
|
-
files:
|
39
|
+
files:
|
47
40
|
- .gitignore
|
48
41
|
- .travis.yml
|
49
42
|
- CHANGELOG.rdoc
|
@@ -150,38 +143,30 @@ files:
|
|
150
143
|
- test/test_zmq.rb
|
151
144
|
homepage: http://github.com/methodmissing/rbczmq
|
152
145
|
licenses: []
|
153
|
-
|
154
146
|
post_install_message:
|
155
|
-
rdoc_options:
|
147
|
+
rdoc_options:
|
156
148
|
- --charset=UTF-8
|
157
|
-
require_paths:
|
149
|
+
require_paths:
|
158
150
|
- lib
|
159
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
160
152
|
none: false
|
161
|
-
requirements:
|
162
|
-
- -
|
163
|
-
- !ruby/object:Gem::Version
|
164
|
-
|
165
|
-
|
166
|
-
- 0
|
167
|
-
version: "0"
|
168
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ! '>='
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
158
|
none: false
|
170
|
-
requirements:
|
171
|
-
- -
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
|
174
|
-
segments:
|
175
|
-
- 0
|
176
|
-
version: "0"
|
159
|
+
requirements:
|
160
|
+
- - ! '>='
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
177
163
|
requirements: []
|
178
|
-
|
179
164
|
rubyforge_project:
|
180
|
-
rubygems_version: 1.8.
|
165
|
+
rubygems_version: 1.8.24
|
181
166
|
signing_key:
|
182
167
|
specification_version: 3
|
183
|
-
summary:
|
184
|
-
test_files:
|
168
|
+
summary: Ruby extension for CZMQ - High-level C Binding for ØMQ (http://czmq.zeromq.org)
|
169
|
+
test_files:
|
185
170
|
- test/helper.rb
|
186
171
|
- test/socket/test_dealer_socket.rb
|
187
172
|
- test/socket/test_pair_socket.rb
|