rbczmq 1.6 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.travis.yml +0 -3
- data/CHANGELOG.rdoc +7 -0
- data/Gemfile.lock +1 -1
- data/ext/czmq-1.4.1.tar.gz +0 -0
- data/ext/rbczmq/beacon.c +318 -0
- data/ext/rbczmq/beacon.h +38 -0
- data/ext/rbczmq/context.c +22 -71
- data/ext/rbczmq/context.h +2 -0
- data/ext/rbczmq/frame.h +1 -1
- data/ext/rbczmq/jruby.h +1 -17
- data/ext/rbczmq/loop.c +2 -3
- data/ext/rbczmq/rbczmq_ext.c +2 -6
- data/ext/rbczmq/rbczmq_ext.h +6 -0
- data/ext/rbczmq/rubinius.h +0 -14
- data/ext/rbczmq/ruby18.h +1 -38
- data/ext/rbczmq/ruby19.h +0 -11
- data/ext/rbczmq/socket.c +223 -245
- data/ext/rbczmq/socket.h +6 -5
- data/lib/zmq.rb +0 -14
- data/lib/zmq/version.rb +1 -1
- data/rbczmq.gemspec +1 -1
- data/test/test_beacon.rb +92 -0
- data/test/test_context.rb +0 -15
- data/test/test_loop.rb +1 -1
- data/test/test_monitoring.rb +0 -4
- data/test/test_poller.rb +1 -1
- data/test/test_socket.rb +62 -52
- metadata +11 -11
- data/ext/czmq-1.4.0.tar.gz +0 -0
data/ext/rbczmq/context.h
CHANGED
data/ext/rbczmq/frame.h
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
if (!(st_lookup(frames_map, (st_data_t)frame, 0))) rb_raise(rb_eZmqError, "ZMQ::Frame instance %p has been destroyed by the ZMQ framework", (void *)obj);
|
11
11
|
|
12
12
|
#define ZmqRegisterFrame(fr) \
|
13
|
-
zframe_freefn((fr), rb_czmq_frame_freed, NULL); \
|
13
|
+
zframe_freefn((fr), (zframe_free_fn *)rb_czmq_frame_freed, NULL); \
|
14
14
|
st_insert(frames_map, (st_data_t)(fr), (st_data_t)0);
|
15
15
|
|
16
16
|
void rb_czmq_free_frame(zframe_t *frame);
|
data/ext/rbczmq/jruby.h
CHANGED
@@ -1,22 +1,6 @@
|
|
1
1
|
#ifndef RBCZMQ_JRUBY_H
|
2
2
|
#define RBCZMQ_JRUBY_H
|
3
3
|
|
4
|
-
#
|
5
|
-
|
6
|
-
/* XXX */
|
7
|
-
#define ZmqEncode(str) str
|
8
|
-
#ifndef THREAD_PASS
|
9
|
-
#define THREAD_PASS rb_thread_schedule();
|
10
|
-
#endif
|
11
|
-
|
12
|
-
#define TRAP_BEG
|
13
|
-
#define TRAP_END
|
14
|
-
|
15
|
-
#undef rb_errinfo
|
16
|
-
#define rb_errinfo() (rb_gv_get("$!"))
|
17
|
-
|
18
|
-
#define ZMQ_DEFAULT_SOCKET_TIMEOUT Qnil
|
19
|
-
|
20
|
-
#define HAVE_RB_THREAD_BLOCKING_REGION 1
|
4
|
+
#error Unsupported Ruby platform - this extension only works with Ruby 1.9, Ruby 2 and Rubinius
|
21
5
|
|
22
6
|
#endif
|
data/ext/rbczmq/loop.c
CHANGED
@@ -84,7 +84,6 @@ ZMQ_NOINLINE static void* rb_czmq_loop_timer_callback_with_gvl(void* data)
|
|
84
84
|
{
|
85
85
|
struct _rb_czmq_callback_invocation* invocation = (struct _rb_czmq_callback_invocation*)data;
|
86
86
|
zloop_t* loop = invocation->loop;
|
87
|
-
zmq_pollitem_t *item = invocation->item;
|
88
87
|
void* cb = invocation->arg;
|
89
88
|
|
90
89
|
VALUE args[3];
|
@@ -285,10 +284,10 @@ static VALUE rb_czmq_loop_start(VALUE obj)
|
|
285
284
|
int rc;
|
286
285
|
errno = 0;
|
287
286
|
ZmqGetLoop(obj);
|
288
|
-
|
287
|
+
rb_thread_schedule();
|
289
288
|
zloop_timer(loop->loop, 1, 1, rb_czmq_loop_started_callback, loop);
|
290
289
|
|
291
|
-
rc = (int)
|
290
|
+
rc = (int)rb_thread_blocking_region(rb_czmq_loop_start_nogvl, (void *)loop, rb_czmq_loop_start_ubf, (void*)loop);
|
292
291
|
|
293
292
|
if (rc > 0) rb_raise(rb_eZmqError, "internal event loop error!");
|
294
293
|
return INT2NUM(rc);
|
data/ext/rbczmq/rbczmq_ext.c
CHANGED
@@ -32,9 +32,7 @@ VALUE intern_readable;
|
|
32
32
|
VALUE intern_writable;
|
33
33
|
VALUE intern_error;
|
34
34
|
|
35
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
36
35
|
rb_encoding *binary_encoding;
|
37
|
-
#endif
|
38
36
|
|
39
37
|
/*
|
40
38
|
* call-seq:
|
@@ -180,9 +178,9 @@ static VALUE rb_czmq_m_proxy_nogvl(void* args)
|
|
180
178
|
* === Examples
|
181
179
|
* context = ZMQ::Context.new
|
182
180
|
* frontend = context.socket(ZMQ::ROUTER)
|
183
|
-
* frontend.bind("tcp
|
181
|
+
* frontend.bind("tcp://127.0.0.1:5555")
|
184
182
|
* backend = context.socket(ZMQ::DEALER)
|
185
|
-
* backend.bind("tcp
|
183
|
+
* backend.bind("tcp://127.0.0.1:5556")
|
186
184
|
* ZMQ.proxy(frontend, backend) => -1 when interrupted
|
187
185
|
*/
|
188
186
|
static VALUE rb_czmq_m_proxy(int argc, VALUE *argv, ZMQ_UNUSED VALUE klass)
|
@@ -225,9 +223,7 @@ void Init_rbczmq_ext()
|
|
225
223
|
intern_writable = rb_intern("on_writable");
|
226
224
|
intern_error = rb_intern("on_error");
|
227
225
|
|
228
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
229
226
|
binary_encoding = rb_enc_find("binary");
|
230
|
-
#endif
|
231
227
|
|
232
228
|
rb_mZmq = rb_define_module("ZMQ");
|
233
229
|
|
data/ext/rbczmq/rbczmq_ext.h
CHANGED
@@ -16,6 +16,12 @@
|
|
16
16
|
|
17
17
|
#include "rbczmq_prelude.h"
|
18
18
|
|
19
|
+
#include <ruby/encoding.h>
|
20
|
+
#include <ruby/io.h>
|
21
|
+
extern rb_encoding *binary_encoding;
|
22
|
+
#define ZmqEncode(str) rb_enc_associate(str, binary_encoding)
|
23
|
+
|
24
|
+
|
19
25
|
#define ZmqRaiseSysError() { \
|
20
26
|
printf("Sys error location: %s:%d\n", __FILE__,__LINE__); \
|
21
27
|
rb_sys_fail(zmq_strerror(zmq_errno())); \
|
data/ext/rbczmq/rubinius.h
CHANGED
@@ -3,22 +3,8 @@
|
|
3
3
|
|
4
4
|
#define RSTRING_NOT_MODIFIED
|
5
5
|
|
6
|
-
#ifdef HAVE_RUBY_ENCODING_H
|
7
6
|
#include <ruby/st.h>
|
8
|
-
#include <ruby/encoding.h>
|
9
|
-
#include <ruby/io.h>
|
10
|
-
extern rb_encoding *binary_encoding;
|
11
|
-
#define ZmqEncode(str) rb_enc_associate(str, binary_encoding)
|
12
|
-
#else
|
13
|
-
#include "st.h"
|
14
|
-
#define ZmqEncode(str) str
|
15
|
-
#endif
|
16
|
-
|
17
|
-
#define TRAP_BEG
|
18
|
-
#define TRAP_END
|
19
7
|
|
20
8
|
#define ZMQ_DEFAULT_SOCKET_TIMEOUT Qnil
|
21
9
|
|
22
|
-
#define THREAD_PASS rb_thread_schedule();
|
23
|
-
|
24
10
|
#endif
|
data/ext/rbczmq/ruby18.h
CHANGED
@@ -1,43 +1,6 @@
|
|
1
1
|
#ifndef RBCZMQ_RUBY18_H
|
2
2
|
#define RBCZMQ_RUBY18_H
|
3
3
|
|
4
|
-
#
|
5
|
-
#define ZmqEncode(str) str
|
6
|
-
#include "rubyio.h"
|
7
|
-
#include "rubysig.h"
|
8
|
-
#include "st.h"
|
9
|
-
|
10
|
-
#ifndef RSTRING_PTR
|
11
|
-
#define RSTRING_PTR(str) RSTRING(str)->ptr
|
12
|
-
#endif
|
13
|
-
#ifndef RSTRING_LEN
|
14
|
-
#define RSTRING_LEN(s) (RSTRING(s)->len)
|
15
|
-
#endif
|
16
|
-
|
17
|
-
/*
|
18
|
-
* partial emulation of the 1.9 rb_thread_blocking_region under 1.8,
|
19
|
-
* this is enough for dealing with blocking I/O functions in the
|
20
|
-
* presence of threads.
|
21
|
-
*/
|
22
|
-
|
23
|
-
#define RUBY_UBF_IO ((rb_unblock_function_t *)-1)
|
24
|
-
typedef void rb_unblock_function_t(void *);
|
25
|
-
typedef VALUE rb_blocking_function_t(void *);
|
26
|
-
static VALUE
|
27
|
-
rb_thread_blocking_region(
|
28
|
-
rb_blocking_function_t *func, void *data1,
|
29
|
-
ZMQ_UNUSED rb_unblock_function_t *ubf,
|
30
|
-
ZMQ_UNUSED void *data2)
|
31
|
-
{
|
32
|
-
VALUE rv;
|
33
|
-
TRAP_BEG;
|
34
|
-
rv = func(data1);
|
35
|
-
TRAP_END;
|
36
|
-
return rv;
|
37
|
-
}
|
38
|
-
|
39
|
-
struct timeval rb_time_interval _((VALUE));
|
40
|
-
|
41
|
-
#define rb_errinfo() ruby_errinfo
|
4
|
+
#error Unsupported Ruby platform - this extension only works with Ruby 1.9, Ruby 2 and Rubinius
|
42
5
|
|
43
6
|
#endif
|
data/ext/rbczmq/ruby19.h
CHANGED
@@ -1,15 +1,4 @@
|
|
1
1
|
#ifndef RBCZMQ_RUBY19_H
|
2
2
|
#define RBCZMQ_RUBY19_H
|
3
3
|
|
4
|
-
#include <ruby/encoding.h>
|
5
|
-
#include <ruby/io.h>
|
6
|
-
extern rb_encoding *binary_encoding;
|
7
|
-
#define ZmqEncode(str) rb_enc_associate(str, binary_encoding)
|
8
|
-
#ifndef THREAD_PASS
|
9
|
-
#define THREAD_PASS rb_thread_schedule();
|
10
|
-
#endif
|
11
|
-
|
12
|
-
#define TRAP_BEG
|
13
|
-
#define TRAP_END
|
14
|
-
|
15
4
|
#endif
|
data/ext/rbczmq/socket.c
CHANGED
@@ -48,7 +48,7 @@ void rb_czmq_free_sock(zmq_sock_wrapper *sock)
|
|
48
48
|
void rb_czmq_mark_sock(void *ptr)
|
49
49
|
{
|
50
50
|
zmq_sock_wrapper *sock = (zmq_sock_wrapper *)ptr;
|
51
|
-
if (sock){
|
51
|
+
if (sock && sock->ctx){
|
52
52
|
if (sock->verbose)
|
53
53
|
zclock_log ("I: %s socket %p, context %p: GC mark", zsocket_type_str(sock->socket), sock, sock->ctx);
|
54
54
|
rb_gc_mark(sock->endpoints);
|
@@ -68,7 +68,7 @@ void rb_czmq_mark_sock(void *ptr)
|
|
68
68
|
void rb_czmq_free_sock_gc(void *ptr)
|
69
69
|
{
|
70
70
|
zmq_sock_wrapper *sock = (zmq_sock_wrapper *)ptr;
|
71
|
-
if (sock){
|
71
|
+
if (sock && sock->ctx){
|
72
72
|
if (sock->verbose)
|
73
73
|
zclock_log ("I: %s socket %p, context %p: GC free", zsocket_type_str(sock->socket), sock, sock->ctx);
|
74
74
|
/*
|
@@ -76,11 +76,6 @@ void rb_czmq_free_sock_gc(void *ptr)
|
|
76
76
|
#4 0x0000000100712524 in zsocket_set_linger (linger=1, socket=<value temporarily unavailable, due to optimizations>) at zsocket.c:288
|
77
77
|
if (sock->socket != NULL && !(sock->flags & ZMQ_SOCKET_DESTROYED)) rb_czmq_free_sock(sock);
|
78
78
|
*/
|
79
|
-
#ifndef HAVE_RB_THREAD_BLOCKING_REGION
|
80
|
-
zlist_destroy(&(sock->str_buffer));
|
81
|
-
zlist_destroy(&(sock->frame_buffer));
|
82
|
-
zlist_destroy(&(sock->msg_buffer));
|
83
|
-
#endif
|
84
79
|
xfree(sock);
|
85
80
|
}
|
86
81
|
}
|
@@ -173,7 +168,7 @@ static VALUE rb_czmq_socket_fd(VALUE obj)
|
|
173
168
|
{
|
174
169
|
zmq_sock_wrapper *sock = NULL;
|
175
170
|
GetZmqSocket(obj);
|
176
|
-
if (sock->state == ZMQ_SOCKET_PENDING) return INT2NUM(-1);
|
171
|
+
if (sock->state == ZMQ_SOCKET_PENDING || sock->state == ZMQ_SOCKET_DISCONNECTED) return INT2NUM(-1);
|
177
172
|
return INT2NUM(zsocket_fd(sock->socket));
|
178
173
|
}
|
179
174
|
|
@@ -274,6 +269,56 @@ static VALUE rb_czmq_socket_connect(VALUE obj, VALUE endpoint)
|
|
274
269
|
return Qtrue;
|
275
270
|
}
|
276
271
|
|
272
|
+
/*
|
273
|
+
* :nodoc:
|
274
|
+
* Disconnects from an endpoint while the GIL is released.
|
275
|
+
*
|
276
|
+
*/
|
277
|
+
VALUE rb_czmq_nogvl_socket_disconnect(void *ptr)
|
278
|
+
{
|
279
|
+
int rc;
|
280
|
+
struct nogvl_conn_args *args = ptr;
|
281
|
+
errno = 0;
|
282
|
+
zmq_sock_wrapper *socket = args->socket;
|
283
|
+
rc = zsocket_disconnect(socket->socket, args->endpoint);
|
284
|
+
return (VALUE)rc;
|
285
|
+
}
|
286
|
+
|
287
|
+
/*
|
288
|
+
* call-seq:
|
289
|
+
* sock.disconnect("tcp://localhost:3456") => boolean
|
290
|
+
*
|
291
|
+
* Attempts to disconnect from a given endpoint.
|
292
|
+
*
|
293
|
+
* === Examples
|
294
|
+
* ctx = ZMQ::Context.new
|
295
|
+
* rep = ctx.socket(:REP)
|
296
|
+
* port = rep.bind("tcp://localhost:*") => 5432
|
297
|
+
* req = ctx.socket(:REQ)
|
298
|
+
* req.connect("tcp://localhost:#{port}") => true
|
299
|
+
* req.disconnect("tcp://localhost:#{port}") => true
|
300
|
+
*
|
301
|
+
*/
|
302
|
+
|
303
|
+
static VALUE rb_czmq_socket_disconnect(VALUE obj, VALUE endpoint)
|
304
|
+
{
|
305
|
+
struct nogvl_conn_args args;
|
306
|
+
int rc;
|
307
|
+
zmq_sock_wrapper *sock = NULL;
|
308
|
+
GetZmqSocket(obj);
|
309
|
+
ZmqSockGuardCrossThread(sock);
|
310
|
+
Check_Type(endpoint, T_STRING);
|
311
|
+
args.socket = sock;
|
312
|
+
args.endpoint = StringValueCStr(endpoint);
|
313
|
+
rc = (int)rb_thread_blocking_region(rb_czmq_nogvl_socket_disconnect, (void *)&args, RUBY_UBF_IO, 0);
|
314
|
+
ZmqAssert(rc);
|
315
|
+
if (sock->verbose)
|
316
|
+
zclock_log ("I: %s socket %p: disconnected \"%s\"", zsocket_type_str(sock->socket), obj, StringValueCStr(endpoint));
|
317
|
+
sock->state = ZMQ_SOCKET_DISCONNECTED;
|
318
|
+
rb_ary_delete(sock->endpoints, endpoint);
|
319
|
+
return Qtrue;
|
320
|
+
}
|
321
|
+
|
277
322
|
/*
|
278
323
|
* call-seq:
|
279
324
|
* sock.verbose = true => nil
|
@@ -307,20 +352,7 @@ static VALUE rb_czmq_nogvl_zstr_send(void *ptr)
|
|
307
352
|
struct nogvl_send_args *args = ptr;
|
308
353
|
errno = 0;
|
309
354
|
zmq_sock_wrapper *socket = args->socket;
|
310
|
-
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
311
355
|
return (VALUE)zstr_send(socket->socket, args->msg);
|
312
|
-
#else
|
313
|
-
if (rb_thread_alone()) return (VALUE)zstr_send(socket->socket, args->msg);
|
314
|
-
try_writable:
|
315
|
-
if ((zsocket_events(socket->socket) & ZMQ_POLLOUT) == ZMQ_POLLOUT) {
|
316
|
-
return (VALUE)zstr_send(socket->socket, args->msg);
|
317
|
-
} else {
|
318
|
-
rb_thread_wait_fd(zsocket_fd(socket->socket));
|
319
|
-
if (zsocket_sndtimeo(socket->socket) != -1)
|
320
|
-
return (VALUE)zstr_send(socket->socket, args->msg);
|
321
|
-
goto try_writable;
|
322
|
-
}
|
323
|
-
#endif
|
324
356
|
}
|
325
357
|
|
326
358
|
/*
|
@@ -333,20 +365,7 @@ static VALUE rb_czmq_nogvl_zstr_sendm(void *ptr)
|
|
333
365
|
struct nogvl_send_args *args = ptr;
|
334
366
|
errno = 0;
|
335
367
|
zmq_sock_wrapper *socket = args->socket;
|
336
|
-
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
337
368
|
return (VALUE)zstr_sendm(socket->socket, args->msg);
|
338
|
-
#else
|
339
|
-
if (rb_thread_alone()) return (VALUE)zstr_sendm(socket->socket, args->msg);
|
340
|
-
try_writable:
|
341
|
-
if ((zsocket_events(socket->socket) & ZMQ_POLLOUT) == ZMQ_POLLOUT) {
|
342
|
-
return (VALUE)zstr_sendm(socket->socket, args->msg);
|
343
|
-
} else {
|
344
|
-
if (zsocket_sndtimeo(socket->socket) != -1)
|
345
|
-
return (VALUE)zstr_sendm(socket->socket, args->msg);
|
346
|
-
rb_thread_wait_fd(zsocket_fd(socket->socket));
|
347
|
-
goto try_writable;
|
348
|
-
}
|
349
|
-
#endif
|
350
369
|
}
|
351
370
|
|
352
371
|
/*
|
@@ -424,24 +443,7 @@ static VALUE rb_czmq_nogvl_recv(void *ptr)
|
|
424
443
|
struct nogvl_recv_args *args = ptr;
|
425
444
|
errno = 0;
|
426
445
|
zmq_sock_wrapper *socket = args->socket;
|
427
|
-
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
428
446
|
return (VALUE)zstr_recv(socket->socket);
|
429
|
-
#else
|
430
|
-
if (zlist_size(socket->str_buffer) != 0)
|
431
|
-
return (VALUE)zlist_pop(socket->str_buffer);
|
432
|
-
try_readable:
|
433
|
-
if ((zsocket_events(socket->socket) & ZMQ_POLLIN) == ZMQ_POLLIN) {
|
434
|
-
do {
|
435
|
-
zlist_append(socket->str_buffer, zstr_recv_nowait(socket->socket));
|
436
|
-
} while (zmq_errno() != EAGAIN && zmq_errno() != EINTR);
|
437
|
-
return (VALUE)zlist_pop(socket->str_buffer);
|
438
|
-
} else {
|
439
|
-
rb_thread_wait_fd(zsocket_fd(socket->socket));
|
440
|
-
if (zsocket_rcvtimeo(socket->socket) != -1)
|
441
|
-
return zstr_recv(socket->socket);
|
442
|
-
goto try_readable;
|
443
|
-
}
|
444
|
-
#endif
|
445
447
|
}
|
446
448
|
|
447
449
|
/*
|
@@ -521,18 +523,7 @@ static VALUE rb_czmq_nogvl_send_frame(void *ptr)
|
|
521
523
|
struct nogvl_send_frame_args *args = ptr;
|
522
524
|
errno = 0;
|
523
525
|
zmq_sock_wrapper *socket = args->socket;
|
524
|
-
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
525
526
|
return (VALUE)zframe_send(&(args->frame), socket->socket, args->flags);
|
526
|
-
#else
|
527
|
-
if (rb_thread_alone()) return (VALUE)zframe_send(&(args->frame), socket->socket, args->flags);
|
528
|
-
try_writable:
|
529
|
-
if ((zsocket_events(socket->socket) & ZMQ_POLLOUT) == ZMQ_POLLOUT) {
|
530
|
-
return (VALUE)zframe_send(&(args->frame), socket->socket, args->flags);
|
531
|
-
} else {
|
532
|
-
rb_thread_wait_fd(zsocket_fd(socket->socket));
|
533
|
-
goto try_writable;
|
534
|
-
}
|
535
|
-
#endif
|
536
527
|
}
|
537
528
|
|
538
529
|
/*
|
@@ -599,21 +590,7 @@ static VALUE rb_czmq_nogvl_send_message(void *ptr)
|
|
599
590
|
struct nogvl_send_message_args *args = ptr;
|
600
591
|
zmq_sock_wrapper *socket = args->socket;
|
601
592
|
errno = 0;
|
602
|
-
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
603
593
|
zmsg_send(&(args->message), socket->socket);
|
604
|
-
#else
|
605
|
-
if (rb_thread_alone()) {
|
606
|
-
zmsg_send(&(args->message), socket->socket);
|
607
|
-
return Qnil;
|
608
|
-
}
|
609
|
-
try_writable:
|
610
|
-
if ((zsocket_events(socket->socket) & ZMQ_POLLOUT) == ZMQ_POLLOUT) {
|
611
|
-
zmsg_send(&(args->message), socket->socket);
|
612
|
-
} else {
|
613
|
-
rb_thread_wait_fd(zsocket_fd(socket->socket));
|
614
|
-
goto try_writable;
|
615
|
-
}
|
616
|
-
#endif
|
617
594
|
return Qnil;
|
618
595
|
}
|
619
596
|
|
@@ -661,22 +638,7 @@ static VALUE rb_czmq_nogvl_recv_frame(void *ptr)
|
|
661
638
|
struct nogvl_recv_args *args = ptr;
|
662
639
|
errno = 0;
|
663
640
|
zmq_sock_wrapper *socket = args->socket;
|
664
|
-
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
665
641
|
return (VALUE)zframe_recv(socket->socket);
|
666
|
-
#else
|
667
|
-
if (zlist_size(socket->frame_buffer) != 0)
|
668
|
-
return (VALUE)zlist_pop(socket->frame_buffer);
|
669
|
-
try_readable:
|
670
|
-
if ((zsocket_events(socket->socket) & ZMQ_POLLIN) == ZMQ_POLLIN) {
|
671
|
-
do {
|
672
|
-
zlist_append(socket->frame_buffer, zframe_recv_nowait(socket->socket));
|
673
|
-
} while (zmq_errno() != EAGAIN && zmq_errno() != EINTR);
|
674
|
-
return (VALUE)zlist_pop(socket->frame_buffer);
|
675
|
-
} else {
|
676
|
-
rb_thread_wait_fd(zsocket_fd(socket->socket));
|
677
|
-
goto try_readable;
|
678
|
-
}
|
679
|
-
#endif
|
680
642
|
}
|
681
643
|
|
682
644
|
/*
|
@@ -756,22 +718,7 @@ static VALUE rb_czmq_nogvl_recv_message(void *ptr)
|
|
756
718
|
struct nogvl_recv_args *args = ptr;
|
757
719
|
errno = 0;
|
758
720
|
zmq_sock_wrapper *socket = args->socket;
|
759
|
-
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
760
721
|
return (VALUE)zmsg_recv(socket->socket);
|
761
|
-
#else
|
762
|
-
if (zlist_size(socket->msg_buffer) != 0)
|
763
|
-
return (VALUE)zlist_pop(socket->msg_buffer);
|
764
|
-
try_readable:
|
765
|
-
if ((zsocket_events(socket->socket) & ZMQ_POLLIN) == ZMQ_POLLIN) {
|
766
|
-
do {
|
767
|
-
zlist_append(socket->msg_buffer, zmsg_recv(socket->socket));
|
768
|
-
} while (zmq_errno() != EAGAIN && zmq_errno() != EINTR);
|
769
|
-
return (VALUE)zlist_pop(socket->msg_buffer);
|
770
|
-
} else {
|
771
|
-
rb_thread_wait_fd(zsocket_fd(socket->socket));
|
772
|
-
goto try_readable;
|
773
|
-
}
|
774
|
-
#endif
|
775
722
|
}
|
776
723
|
|
777
724
|
/*
|
@@ -803,89 +750,46 @@ static VALUE rb_czmq_socket_recv_message(VALUE obj)
|
|
803
750
|
return rb_czmq_alloc_message(message);
|
804
751
|
}
|
805
752
|
|
806
|
-
#if ZMQ_VERSION_MAJOR == 2
|
807
|
-
|
808
753
|
/*
|
809
|
-
*
|
810
|
-
*
|
811
|
-
*
|
812
|
-
* Returns the socket HWM (High Water Mark) value.
|
813
|
-
*
|
814
|
-
* === Examples
|
815
|
-
* ctx = ZMQ::Context.new
|
816
|
-
* sock = ctx.socket(:REP)
|
817
|
-
* sock.hwm => 0
|
818
|
-
*
|
819
|
-
*/
|
820
|
-
|
821
|
-
static VALUE rb_czmq_socket_opt_hwm(VALUE obj)
|
822
|
-
{
|
823
|
-
zmq_sock_wrapper *sock = NULL;
|
824
|
-
GetZmqSocket(obj);
|
825
|
-
return INT2NUM(zsocket_hwm(sock->socket));
|
826
|
-
}
|
827
|
-
|
828
|
-
/*
|
829
|
-
* call-seq:
|
830
|
-
* sock.hwm = 100 => nil
|
831
|
-
*
|
832
|
-
* Sets the socket HWM (High Water Mark() value.
|
833
|
-
*
|
834
|
-
* === Examples
|
835
|
-
* ctx = ZMQ::Context.new
|
836
|
-
* sock = ctx.socket(:REP)
|
837
|
-
* sock.hwm = 100 => nil
|
838
|
-
* sock.hwm => 100
|
754
|
+
* :nodoc:
|
755
|
+
* Poll for input while the GIL is released.
|
839
756
|
*
|
840
757
|
*/
|
841
|
-
|
842
|
-
static VALUE rb_czmq_socket_set_opt_hwm(VALUE obj, VALUE value)
|
758
|
+
static VALUE rb_czmq_nogvl_poll(void *ptr)
|
843
759
|
{
|
844
|
-
|
845
|
-
|
760
|
+
struct nogvl_socket_poll_args *args = ptr;
|
761
|
+
zmq_sock_wrapper *socket = args->socket;
|
762
|
+
return (VALUE)zsocket_poll(socket->socket, args->timeout);
|
846
763
|
}
|
847
764
|
|
848
765
|
/*
|
849
766
|
* call-seq:
|
850
|
-
* sock.
|
767
|
+
* sock.poll(100) => Boolean
|
851
768
|
*
|
852
|
-
*
|
769
|
+
* Poll for input events on the socket. Returns true if there is input, otherwise false.
|
853
770
|
*
|
854
771
|
* === Examples
|
855
772
|
* ctx = ZMQ::Context.new
|
856
773
|
* sock = ctx.socket(:REP)
|
857
|
-
* sock.
|
774
|
+
* sock.bind("inproc://test")
|
775
|
+
* sock.poll(100) => true
|
858
776
|
*
|
859
777
|
*/
|
860
778
|
|
861
|
-
static VALUE
|
779
|
+
static VALUE rb_czmq_socket_poll(VALUE obj, VALUE timeout)
|
862
780
|
{
|
781
|
+
bool readable;
|
782
|
+
struct nogvl_socket_poll_args args;
|
863
783
|
zmq_sock_wrapper *sock = NULL;
|
864
784
|
GetZmqSocket(obj);
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
*
|
870
|
-
|
871
|
-
*
|
872
|
-
* Sets the socket SWAP value.
|
873
|
-
*
|
874
|
-
* === Examples
|
875
|
-
* ctx = ZMQ::Context.new
|
876
|
-
* sock = ctx.socket(:REP)
|
877
|
-
* sock.swap = 100 => nil
|
878
|
-
*
|
879
|
-
*/
|
880
|
-
|
881
|
-
static VALUE rb_czmq_socket_set_opt_swap(VALUE obj, VALUE value)
|
882
|
-
{
|
883
|
-
zmq_sock_wrapper *sock = NULL;
|
884
|
-
ZmqSetSockOpt(obj, zsocket_set_swap, "SWAP", value);
|
785
|
+
Check_Type(timeout, T_FIXNUM);
|
786
|
+
ZmqSockGuardCrossThread(sock);
|
787
|
+
args.socket = sock;
|
788
|
+
args.timeout = FIX2INT(timeout);
|
789
|
+
readable = (bool)rb_thread_blocking_region(rb_czmq_nogvl_poll, (void *)&args, RUBY_UBF_IO, 0);
|
790
|
+
return (readable == true) ? Qtrue : Qfalse;
|
885
791
|
}
|
886
|
-
#endif
|
887
792
|
|
888
|
-
#if ZMQ_VERSION_MAJOR == 3
|
889
793
|
/*
|
890
794
|
* call-seq:
|
891
795
|
* sock.sndhwm => Fixnum
|
@@ -965,7 +869,6 @@ static VALUE rb_czmq_socket_set_opt_rcvhwm(VALUE obj, VALUE value)
|
|
965
869
|
zmq_sock_wrapper *sock = NULL;
|
966
870
|
ZmqSetSockOpt(obj, zsocket_set_rcvhwm, "RCVHWM", value);
|
967
871
|
}
|
968
|
-
#endif
|
969
872
|
|
970
873
|
/*
|
971
874
|
* call-seq:
|
@@ -1084,85 +987,200 @@ static VALUE rb_czmq_socket_set_opt_recovery_ivl(VALUE obj, VALUE value)
|
|
1084
987
|
ZmqSetSockOpt(obj, zsocket_set_recovery_ivl, "RECOVERY_IVL", value);
|
1085
988
|
}
|
1086
989
|
|
1087
|
-
#if ZMQ_VERSION_MAJOR == 2
|
1088
990
|
/*
|
1089
991
|
* call-seq:
|
1090
|
-
* sock.
|
992
|
+
* sock.maxmsgsize => Fixnum
|
1091
993
|
*
|
1092
|
-
* Returns the socket
|
994
|
+
* Returns the socket MAXMSGSIZE value.
|
1093
995
|
*
|
1094
996
|
* === Examples
|
1095
997
|
* ctx = ZMQ::Context.new
|
1096
998
|
* sock = ctx.socket(:REP)
|
1097
|
-
* sock.
|
999
|
+
* sock.maxmsgsize => 10
|
1098
1000
|
*
|
1099
1001
|
*/
|
1100
1002
|
|
1101
|
-
static VALUE
|
1003
|
+
static VALUE rb_czmq_socket_opt_maxmsgsize(VALUE obj)
|
1102
1004
|
{
|
1103
1005
|
zmq_sock_wrapper *sock = NULL;
|
1104
1006
|
GetZmqSocket(obj);
|
1105
|
-
return INT2NUM(
|
1007
|
+
return INT2NUM(zsocket_maxmsgsize(sock->socket));
|
1106
1008
|
}
|
1107
1009
|
|
1108
1010
|
/*
|
1109
1011
|
* call-seq:
|
1110
|
-
* sock.
|
1012
|
+
* sock.maxmsgsize = 20 => nil
|
1111
1013
|
*
|
1112
|
-
* Sets the socket
|
1014
|
+
* Sets the socket MAXMSGSIZE value.
|
1113
1015
|
*
|
1114
1016
|
* === Examples
|
1115
1017
|
* ctx = ZMQ::Context.new
|
1116
1018
|
* sock = ctx.socket(:REP)
|
1117
|
-
* sock.
|
1019
|
+
* sock.maxmsgsize = 20 => nil
|
1118
1020
|
*
|
1119
1021
|
*/
|
1120
1022
|
|
1121
|
-
static VALUE
|
1023
|
+
static VALUE rb_czmq_socket_set_opt_maxmsgsize(VALUE obj, VALUE value)
|
1122
1024
|
{
|
1123
1025
|
zmq_sock_wrapper *sock = NULL;
|
1124
|
-
ZmqSetSockOpt(obj,
|
1026
|
+
ZmqSetSockOpt(obj, zsocket_set_maxmsgsize, "MAXMSGSIZE", value);
|
1125
1027
|
}
|
1126
1028
|
|
1127
1029
|
/*
|
1128
1030
|
* call-seq:
|
1129
|
-
* sock.
|
1031
|
+
* sock.multicast_hops => Fixnum
|
1130
1032
|
*
|
1131
|
-
* Returns the socket
|
1033
|
+
* Returns the socket MULTICAST_HOPS value.
|
1132
1034
|
*
|
1133
1035
|
* === Examples
|
1134
1036
|
* ctx = ZMQ::Context.new
|
1135
1037
|
* sock = ctx.socket(:REP)
|
1136
|
-
* sock.
|
1038
|
+
* sock.multicast_hops => 10
|
1137
1039
|
*
|
1138
1040
|
*/
|
1139
1041
|
|
1140
|
-
static VALUE
|
1042
|
+
static VALUE rb_czmq_socket_opt_multicast_hops(VALUE obj)
|
1141
1043
|
{
|
1142
1044
|
zmq_sock_wrapper *sock = NULL;
|
1143
1045
|
GetZmqSocket(obj);
|
1144
|
-
return (
|
1046
|
+
return INT2NUM(zsocket_multicast_hops(sock->socket));
|
1145
1047
|
}
|
1146
1048
|
|
1147
1049
|
/*
|
1148
1050
|
* call-seq:
|
1149
|
-
* sock.
|
1051
|
+
* sock.multicast_hops = 20 => nil
|
1150
1052
|
*
|
1151
|
-
* Sets the socket
|
1053
|
+
* Sets the socket MULTICAST_HOPS value.
|
1152
1054
|
*
|
1153
1055
|
* === Examples
|
1154
1056
|
* ctx = ZMQ::Context.new
|
1155
1057
|
* sock = ctx.socket(:REP)
|
1156
|
-
* sock.
|
1058
|
+
* sock.multicast_hops = 20 => nil
|
1157
1059
|
*
|
1158
1060
|
*/
|
1159
1061
|
|
1160
|
-
static VALUE
|
1062
|
+
static VALUE rb_czmq_socket_set_opt_multicast_hops(VALUE obj, VALUE value)
|
1161
1063
|
{
|
1162
1064
|
zmq_sock_wrapper *sock = NULL;
|
1163
|
-
|
1065
|
+
ZmqSetSockOpt(obj, zsocket_set_multicast_hops, "MULTICAST_HOPS", value);
|
1066
|
+
}
|
1067
|
+
|
1068
|
+
/*
|
1069
|
+
* call-seq:
|
1070
|
+
* sock.ipv4only => Boolean
|
1071
|
+
*
|
1072
|
+
* Returns the socket IPV4ONLY value.
|
1073
|
+
*
|
1074
|
+
* === Examples
|
1075
|
+
* ctx = ZMQ::Context.new
|
1076
|
+
* sock = ctx.socket(:REP)
|
1077
|
+
* sock.ipv4only => false
|
1078
|
+
*
|
1079
|
+
*/
|
1080
|
+
|
1081
|
+
static VALUE rb_czmq_socket_opt_ipv4only(VALUE obj)
|
1082
|
+
{
|
1083
|
+
int ipv4only;
|
1084
|
+
zmq_sock_wrapper *sock = NULL;
|
1085
|
+
GetZmqSocket(obj);
|
1086
|
+
ipv4only = zsocket_ipv4only(sock->socket);
|
1087
|
+
return (ipv4only == 0 ? Qfalse : Qtrue);
|
1088
|
+
}
|
1089
|
+
|
1090
|
+
/*
|
1091
|
+
* call-seq:
|
1092
|
+
* sock.ipv4only = true => nil
|
1093
|
+
*
|
1094
|
+
* Sets the socket IPV4ONLY value.
|
1095
|
+
*
|
1096
|
+
* === Examples
|
1097
|
+
* ctx = ZMQ::Context.new
|
1098
|
+
* sock = ctx.socket(:REP)
|
1099
|
+
* sock.ipv4only = true => nil
|
1100
|
+
*
|
1101
|
+
*/
|
1102
|
+
|
1103
|
+
static VALUE rb_czmq_socket_set_opt_ipv4only(VALUE obj, VALUE value)
|
1104
|
+
{
|
1105
|
+
zmq_sock_wrapper *sock = NULL;
|
1106
|
+
ZmqSetBooleanSockOpt(obj, zsocket_set_ipv4only, "IPV4ONLY", value);
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
/*
|
1110
|
+
* call-seq:
|
1111
|
+
* sock.delay_attach_on_connect = true => nil
|
1112
|
+
*
|
1113
|
+
* Sets the socket DELAY_ATTACH_ON_CONNECT value.
|
1114
|
+
*
|
1115
|
+
* === Examples
|
1116
|
+
* ctx = ZMQ::Context.new
|
1117
|
+
* sock = ctx.socket(:REP)
|
1118
|
+
* sock.delay_attach_on_connect = true => nil
|
1119
|
+
*
|
1120
|
+
*/
|
1121
|
+
|
1122
|
+
static VALUE rb_czmq_socket_set_opt_delay_attach_on_connect(VALUE obj, VALUE value)
|
1123
|
+
{
|
1124
|
+
zmq_sock_wrapper *sock = NULL;
|
1125
|
+
ZmqSetBooleanSockOpt(obj, zsocket_set_delay_attach_on_connect, "DELAY_ATTACH_ON_CONNECT", value);
|
1126
|
+
}
|
1127
|
+
|
1128
|
+
/*
|
1129
|
+
* call-seq:
|
1130
|
+
* sock.router_mandatory = true => nil
|
1131
|
+
*
|
1132
|
+
* Sets the socket ROUTER_MANDATORY value.
|
1133
|
+
*
|
1134
|
+
* === Examples
|
1135
|
+
* ctx = ZMQ::Context.new
|
1136
|
+
* sock = ctx.socket(:REP)
|
1137
|
+
* sock.router_mandatory = true => nil
|
1138
|
+
*
|
1139
|
+
*/
|
1140
|
+
|
1141
|
+
static VALUE rb_czmq_socket_set_opt_router_mandatory(VALUE obj, VALUE value)
|
1142
|
+
{
|
1143
|
+
zmq_sock_wrapper *sock = NULL;
|
1144
|
+
ZmqSetBooleanSockOpt(obj, zsocket_set_router_mandatory, "ROUTER_MANDATORY", value);
|
1145
|
+
}
|
1146
|
+
|
1147
|
+
/*
|
1148
|
+
* call-seq:
|
1149
|
+
* sock.router_raw= true => nil
|
1150
|
+
*
|
1151
|
+
* Sets the socket ROUTER_RAW value.
|
1152
|
+
*
|
1153
|
+
* === Examples
|
1154
|
+
* ctx = ZMQ::Context.new
|
1155
|
+
* sock = ctx.socket(:REP)
|
1156
|
+
* sock.router_raw = true => nil
|
1157
|
+
*
|
1158
|
+
*/
|
1159
|
+
|
1160
|
+
static VALUE rb_czmq_socket_set_opt_router_raw(VALUE obj, VALUE value)
|
1161
|
+
{
|
1162
|
+
zmq_sock_wrapper *sock = NULL;
|
1163
|
+
ZmqSetBooleanSockOpt(obj, zsocket_set_router_raw, "ROUTER_RAW", value);
|
1164
|
+
}
|
1165
|
+
|
1166
|
+
/*
|
1167
|
+
* call-seq:
|
1168
|
+
* sock.xpub_verbose = true => nil
|
1169
|
+
*
|
1170
|
+
* Sets the socket XPUB_VERBOSE value.
|
1171
|
+
*
|
1172
|
+
* === Examples
|
1173
|
+
* ctx = ZMQ::Context.new
|
1174
|
+
* sock = ctx.socket(:REP)
|
1175
|
+
* sock.xpub_verbose = true => nil
|
1176
|
+
*
|
1177
|
+
*/
|
1178
|
+
|
1179
|
+
static VALUE rb_czmq_socket_set_opt_xpub_verbose(VALUE obj, VALUE value)
|
1180
|
+
{
|
1181
|
+
zmq_sock_wrapper *sock = NULL;
|
1182
|
+
ZmqSetBooleanSockOpt(obj, zsocket_set_xpub_verbose, "XPUB_VERBOSE", value);
|
1164
1183
|
}
|
1165
|
-
#endif
|
1166
1184
|
|
1167
1185
|
/*
|
1168
1186
|
* call-seq:
|
@@ -1587,27 +1605,6 @@ static VALUE rb_czmq_socket_set_opt_sndtimeo(VALUE obj, VALUE value)
|
|
1587
1605
|
ZmqSetSockOpt(obj, zsocket_set_sndtimeo, "SNDTIMEO", value);
|
1588
1606
|
}
|
1589
1607
|
|
1590
|
-
#if defined (ZMQ_ROUTER_RAW)
|
1591
|
-
/*
|
1592
|
-
* call-seq:
|
1593
|
-
* sock.raw = true => nil
|
1594
|
-
*
|
1595
|
-
* Define this as a RAW socket - applicable to ROUTER sockets only.
|
1596
|
-
*
|
1597
|
-
* === Examples
|
1598
|
-
* ctx = ZMQ::Context.new
|
1599
|
-
* sock = ctx.socket(:ROUTER)
|
1600
|
-
* sock.router = 200 => nil
|
1601
|
-
*
|
1602
|
-
*/
|
1603
|
-
|
1604
|
-
static VALUE rb_czmq_socket_set_opt_raw(VALUE obj, VALUE value)
|
1605
|
-
{
|
1606
|
-
zmq_sock_wrapper *sock = NULL;
|
1607
|
-
ZmqSetBooleanSockOpt(obj, zsocket_set_router_raw, "ROUTER_RAW", value);
|
1608
|
-
}
|
1609
|
-
#endif
|
1610
|
-
|
1611
1608
|
/*
|
1612
1609
|
* :nodoc:
|
1613
1610
|
* Receives a monitoring event message while the GIL is released.
|
@@ -1618,20 +1615,7 @@ static VALUE rb_czmq_nogvl_monitor_recv(void *ptr)
|
|
1618
1615
|
{
|
1619
1616
|
struct nogvl_monitor_recv_args *args = ptr;
|
1620
1617
|
int rc;
|
1621
|
-
#ifdef HAVE_RB_THREAD_BLOCKING_REGION
|
1622
1618
|
rc = zmq_recvmsg (args->socket, &args->msg, 0);
|
1623
|
-
#else
|
1624
|
-
int fd;
|
1625
|
-
size_t option_len = sizeof (int);
|
1626
|
-
zmq_getsockopt (args->socket, ZMQ_FD, &fd, &option_len);
|
1627
|
-
try_readable:
|
1628
|
-
if ((zsocket_events(args->socket) & ZMQ_POLLIN) == ZMQ_POLLIN) {
|
1629
|
-
rc = zmq_recvmsg (args->socket, &args->msg, 0);
|
1630
|
-
} else {
|
1631
|
-
rb_thread_wait_fd(fd);
|
1632
|
-
goto try_readable;
|
1633
|
-
}
|
1634
|
-
#endif
|
1635
1619
|
return (VALUE)rc;
|
1636
1620
|
}
|
1637
1621
|
|
@@ -1654,7 +1638,7 @@ static VALUE rb_czmq_socket_monitor_thread(void *arg)
|
|
1654
1638
|
rc = zmq_connect (s, StringValueCStr(sock->monitor_endpoint));
|
1655
1639
|
assert (rc == 0);
|
1656
1640
|
|
1657
|
-
|
1641
|
+
rb_thread_schedule();
|
1658
1642
|
|
1659
1643
|
while (1) {
|
1660
1644
|
args.socket = s;
|
@@ -1729,7 +1713,6 @@ static VALUE rb_czmq_socket_monitor(int argc, VALUE *argv, VALUE obj)
|
|
1729
1713
|
sock->monitor_endpoint = endpoint;
|
1730
1714
|
sock->monitor_handler = handler;
|
1731
1715
|
sock->monitor_thread = rb_thread_create(rb_czmq_socket_monitor_thread, (void*)sock);
|
1732
|
-
rb_thread_run(sock->monitor_thread);
|
1733
1716
|
return Qtrue;
|
1734
1717
|
} else {
|
1735
1718
|
return Qfalse;
|
@@ -1765,12 +1748,14 @@ void _init_rb_czmq_socket()
|
|
1765
1748
|
rb_define_const(rb_cZmqSocket, "PENDING", INT2NUM(ZMQ_SOCKET_PENDING));
|
1766
1749
|
rb_define_const(rb_cZmqSocket, "BOUND", INT2NUM(ZMQ_SOCKET_BOUND));
|
1767
1750
|
rb_define_const(rb_cZmqSocket, "CONNECTED", INT2NUM(ZMQ_SOCKET_CONNECTED));
|
1751
|
+
rb_define_const(rb_cZmqSocket, "DISCONNECTED", INT2NUM(ZMQ_SOCKET_DISCONNECTED));
|
1768
1752
|
|
1769
1753
|
rb_define_method(rb_cZmqSocket, "close", rb_czmq_socket_close, 0);
|
1770
1754
|
rb_define_method(rb_cZmqSocket, "endpoints", rb_czmq_socket_endpoints, 0);
|
1771
1755
|
rb_define_method(rb_cZmqSocket, "state", rb_czmq_socket_state, 0);
|
1772
1756
|
rb_define_method(rb_cZmqSocket, "real_bind", rb_czmq_socket_bind, 1);
|
1773
1757
|
rb_define_method(rb_cZmqSocket, "real_connect", rb_czmq_socket_connect, 1);
|
1758
|
+
rb_define_method(rb_cZmqSocket, "disconnect", rb_czmq_socket_disconnect, 1);
|
1774
1759
|
rb_define_method(rb_cZmqSocket, "fd", rb_czmq_socket_fd, 0);
|
1775
1760
|
rb_define_alias(rb_cZmqSocket, "to_i", "fd");
|
1776
1761
|
rb_define_method(rb_cZmqSocket, "verbose=", rb_czmq_socket_set_verbose, 1);
|
@@ -1783,35 +1768,28 @@ void _init_rb_czmq_socket()
|
|
1783
1768
|
rb_define_method(rb_cZmqSocket, "recv_frame", rb_czmq_socket_recv_frame, 0);
|
1784
1769
|
rb_define_method(rb_cZmqSocket, "recv_frame_nonblock", rb_czmq_socket_recv_frame_nonblock, 0);
|
1785
1770
|
rb_define_method(rb_cZmqSocket, "recv_message", rb_czmq_socket_recv_message, 0);
|
1771
|
+
rb_define_method(rb_cZmqSocket, "poll", rb_czmq_socket_poll, 1);
|
1786
1772
|
|
1787
|
-
#if ZMQ_VERSION_MAJOR == 2
|
1788
|
-
rb_define_method(rb_cZmqSocket, "swap", rb_czmq_socket_opt_swap, 0);
|
1789
|
-
rb_define_method(rb_cZmqSocket, "swap=", rb_czmq_socket_set_opt_swap, 1);
|
1790
|
-
rb_define_method(rb_cZmqSocket, "recovery_ivl_msec", rb_czmq_socket_opt_recovery_ivl_msec, 0);
|
1791
|
-
rb_define_method(rb_cZmqSocket, "recovery_ivl_msec=", rb_czmq_socket_set_opt_recovery_ivl_msec, 1);
|
1792
|
-
rb_define_method(rb_cZmqSocket, "mcast_loop?", rb_czmq_socket_opt_mcast_loop, 0);
|
1793
|
-
rb_define_method(rb_cZmqSocket, "mcast_loop=", rb_czmq_socket_set_opt_mcast_loop, 1);
|
1794
|
-
rb_define_method(rb_cZmqSocket, "hwm", rb_czmq_socket_opt_hwm, 0);
|
1795
|
-
rb_define_method(rb_cZmqSocket, "hwm=", rb_czmq_socket_set_opt_hwm, 1);
|
1796
|
-
#endif
|
1797
|
-
|
1798
|
-
#if ZMQ_VERSION_MAJOR == 3
|
1799
1773
|
rb_define_method(rb_cZmqSocket, "sndhwm", rb_czmq_socket_opt_sndhwm, 0);
|
1800
1774
|
rb_define_method(rb_cZmqSocket, "sndhwm=", rb_czmq_socket_set_opt_sndhwm, 1);
|
1801
1775
|
rb_define_method(rb_cZmqSocket, "rcvhwm", rb_czmq_socket_opt_rcvhwm, 0);
|
1802
1776
|
rb_define_method(rb_cZmqSocket, "rcvhwm=", rb_czmq_socket_set_opt_rcvhwm, 1);
|
1803
|
-
|
1804
|
-
#if defined (ZMQ_ROUTER_RAW)
|
1805
|
-
rb_define_method(rb_cZmqSocket, "raw=", rb_czmq_socket_set_opt_raw, 1);
|
1806
|
-
#endif
|
1807
|
-
#endif
|
1808
|
-
|
1809
1777
|
rb_define_method(rb_cZmqSocket, "affinity", rb_czmq_socket_opt_affinity, 0);
|
1810
1778
|
rb_define_method(rb_cZmqSocket, "affinity=", rb_czmq_socket_set_opt_affinity, 1);
|
1811
1779
|
rb_define_method(rb_cZmqSocket, "rate", rb_czmq_socket_opt_rate, 0);
|
1812
1780
|
rb_define_method(rb_cZmqSocket, "rate=", rb_czmq_socket_set_opt_rate, 1);
|
1813
1781
|
rb_define_method(rb_cZmqSocket, "recovery_ivl", rb_czmq_socket_opt_recovery_ivl, 0);
|
1814
1782
|
rb_define_method(rb_cZmqSocket, "recovery_ivl=", rb_czmq_socket_set_opt_recovery_ivl, 1);
|
1783
|
+
rb_define_method(rb_cZmqSocket, "maxmsgsize", rb_czmq_socket_opt_maxmsgsize, 0);
|
1784
|
+
rb_define_method(rb_cZmqSocket, "maxmsgsize=", rb_czmq_socket_set_opt_maxmsgsize, 1);
|
1785
|
+
rb_define_method(rb_cZmqSocket, "multicast_hops", rb_czmq_socket_opt_multicast_hops, 0);
|
1786
|
+
rb_define_method(rb_cZmqSocket, "multicast_hops=", rb_czmq_socket_set_opt_multicast_hops, 1);
|
1787
|
+
rb_define_method(rb_cZmqSocket, "ipv4only?", rb_czmq_socket_opt_ipv4only, 0);
|
1788
|
+
rb_define_method(rb_cZmqSocket, "ipv4only=", rb_czmq_socket_set_opt_ipv4only, 1);
|
1789
|
+
rb_define_method(rb_cZmqSocket, "delay_attach_on_connect=", rb_czmq_socket_set_opt_delay_attach_on_connect, 1);
|
1790
|
+
rb_define_method(rb_cZmqSocket, "router_mandatory=", rb_czmq_socket_set_opt_router_mandatory, 1);
|
1791
|
+
rb_define_method(rb_cZmqSocket, "router_raw=", rb_czmq_socket_set_opt_router_raw, 1);
|
1792
|
+
rb_define_method(rb_cZmqSocket, "xpub_verbose=", rb_czmq_socket_set_opt_xpub_verbose, 1);
|
1815
1793
|
rb_define_method(rb_cZmqSocket, "sndbuf", rb_czmq_socket_opt_sndbuf, 0);
|
1816
1794
|
rb_define_method(rb_cZmqSocket, "sndbuf=", rb_czmq_socket_set_opt_sndbuf, 1);
|
1817
1795
|
rb_define_method(rb_cZmqSocket, "rcvbuf", rb_czmq_socket_opt_rcvbuf, 0);
|