nanomsg 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/HISTORY CHANGED
@@ -3,6 +3,7 @@
3
3
  * Fixes GVL related blocking behaviour, recv/send will now _NOT_ consume
4
4
  a whole core.
5
5
  * Adds a raw setsockopt that allows settting various types of values.
6
+ * Adds #unsubscribe method to SubSocket. (Anastas Semenov)
6
7
 
7
8
  = 0.2 / 26Aug2013
8
9
 
data/README CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  TLDR
3
2
 
4
3
  An idiomatic nanomsg wrapper for Ruby.
@@ -27,7 +26,8 @@ stack. At the moment, nanomsg library supports following transports:
27
26
 
28
27
  DOCUMENTATION
29
28
 
30
- Check out the examples folder of the project. See http://nanomsg.org/ for more
29
+ Check out the examples folder of the project. See
30
+ http://kschiess.bitbucket.org/nanomsg/ and http://nanomsg.org/ for more
31
31
  documentation.
32
32
 
33
33
  SYNOPSIS
@@ -1,3 +1,7 @@
1
+
2
+ # This example is about blocking sockets and thread abortion in Ruby. It
3
+ # is not very instructive. More of a test.
4
+
1
5
  $:.unshift File.dirname(__FILE__) + "/../lib"
2
6
  require 'nanomsg'
3
7
  include NanoMsg
@@ -1,3 +1,6 @@
1
+
2
+ # How to use the BUS socket.
3
+
1
4
  $:.unshift File.dirname(__FILE__) + "/../lib"
2
5
  require 'nanomsg'
3
6
  include NanoMsg
@@ -1,3 +1,6 @@
1
+
2
+ # How to connect two BUSes using a device.
3
+
1
4
  $:.unshift File.dirname(__FILE__) + "/../lib"
2
5
  require 'nanomsg'
3
6
  include NanoMsg
@@ -1,4 +1,6 @@
1
1
 
2
+ # Demonstrates a PAIR socket via IPC transport.
3
+
2
4
  $:.unshift File.dirname(__FILE__) + "/../lib"
3
5
  require 'nanomsg'
4
6
 
data/ext/init.c CHANGED
@@ -77,20 +77,6 @@ sock_get(VALUE socket)
77
77
  return psock->socket;
78
78
  }
79
79
 
80
- static int
81
- nn_get_rcv_fd(int sock)
82
- {
83
- int fd;
84
- size_t size = sizeof(fd);
85
- int err;
86
-
87
- err = nn_getsockopt(sock, NN_SOL_SOCKET, NN_RCVFD, &fd, &size);
88
- if (err < 0)
89
- return err;
90
-
91
- return fd;
92
- }
93
-
94
80
  static VALUE
95
81
  sock_alloc(VALUE klass)
96
82
  {
@@ -332,6 +318,23 @@ sub_sock_subscribe(VALUE socket, VALUE channel)
332
318
  return socket;
333
319
  }
334
320
 
321
+ static VALUE
322
+ sub_sock_unsubscribe(VALUE socket, VALUE channel)
323
+ {
324
+ int sock = sock_get(socket);
325
+ int err;
326
+
327
+ err = nn_setsockopt(
328
+ sock, NN_SUB, NN_SUB_UNSUBSCRIBE,
329
+ StringValuePtr(channel),
330
+ RSTRING_LEN(channel)
331
+ );
332
+ if (err < 0)
333
+ RAISE_SOCK_ERROR;
334
+
335
+ return socket;
336
+ }
337
+
335
338
  static VALUE
336
339
  srvy_set_deadline(VALUE self, VALUE deadline)
337
340
  {
@@ -459,6 +462,7 @@ Init_nanomsg(void)
459
462
  rb_define_method(cPubSocket, "initialize", pub_sock_init, -1);
460
463
  rb_define_method(cSubSocket, "initialize", sub_sock_init, -1);
461
464
  rb_define_method(cSubSocket, "subscribe", sub_sock_subscribe, 1);
465
+ rb_define_method(cSubSocket, "unsubscribe", sub_sock_unsubscribe, 1);
462
466
 
463
467
  rb_define_method(cSurveySocket, "initialize", srvy_sock_init, -1);
464
468
  rb_define_method(cSurveySocket, "deadline=", srvy_set_deadline, 1);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanomsg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-04 00:00:00.000000000 Z
12
+ date: 2013-11-25 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! " nanomsg library is a high-performance implementation of several
15
15
  \"scalability \n protocols\". Scalability protocol's job is to define how multiple