Commits

Anastas Dancha  committed a7b8b64

UNSUBSCRIBE: adding a trivial unsubscribe function to sub socket (with "Paul Laidler <plaidler@gmail.com>")

  • Participants
  • Parent commits 5839932

Comments (0)

Files changed (3)

 mkmf.log
 ext/*.o
 ext/*.bundle
+
+web/vendor
 }
 
 static VALUE
+sub_sock_unsubscribe(VALUE socket, VALUE channel)
+{
+  int sock = sock_get(socket);
+  int err;
+
+  err = nn_setsockopt(
+    sock, NN_SUB, NN_SUB_UNSUBSCRIBE,
+    StringValuePtr(channel),
+    RSTRING_LEN(channel)
+  );
+  if (err < 0)
+    RAISE_SOCK_ERROR;
+
+  return socket;
+}
+
+static VALUE
 srvy_set_deadline(VALUE self, VALUE deadline)
 {
   int sock = sock_get(self);
   rb_define_method(cPubSocket, "initialize", pub_sock_init, -1);
   rb_define_method(cSubSocket, "initialize", sub_sock_init, -1);
   rb_define_method(cSubSocket, "subscribe", sub_sock_subscribe, 1);
+  rb_define_method(cSubSocket, "unsubscribe", sub_sock_unsubscribe, 1);
 
   rb_define_method(cSurveySocket, "initialize", srvy_sock_init, -1);
   rb_define_method(cSurveySocket, "deadline=", srvy_set_deadline, 1);

File nanomsg.gemspec

 
 Gem::Specification.new do |s|
   s.name = 'nanomsg'
-  s.version = '0.3.2'
+  s.version = '0.3.3'
 
   s.authors = ['Kaspar Schiess']
   s.email = 'kaspar.schiess@absurd.li'