Skip to content

Commit

Permalink
fix boazsegev#134 + docs + bump
Browse files Browse the repository at this point in the history
  • Loading branch information
boazsegev committed Dec 10, 2022
1 parent 82c97d9 commit ff0e9f8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ Please notice that this change log contains changes for upcoming releases as wel

## Changes:


#### Change log v.0.7.52 (2022-12-10)

**Fix**: Fixes `Iodine.unsubscribe` which failed when a symbol was supplied. Credit to Alexander Pavlenko (@raxoft) for opening issue #134.

**Fix**: Fixes `Iodine.is_worker` which gave an incorrect answer due to a copy & paste error. Credit to Alexander Pavlenko (@raxoft) for opening PR #133.

#### Change log v.0.7.51 (2022-12-03)

**Fix**: Fixes CPU spin error caused by an uncaught integer overflow. Credit to Alexander Pavlenko (@AlexanderPavlenko) for opening issue #132.
Expand Down
10 changes: 7 additions & 3 deletions ext/iodine/iodine_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ Ruby Connection Methods - Pub/Sub
***************************************************************************** */

typedef struct {
VALUE channel_org;
VALUE channel;
VALUE block;
fio_match_fn pattern;
Expand All @@ -506,7 +507,7 @@ typedef struct {
/** Tests the `subscribe` Ruby arguments */
static iodine_sub_args_s iodine_subscribe_args(int argc, VALUE *argv) {

iodine_sub_args_s ret = {.channel = Qnil, .block = Qnil};
iodine_sub_args_s ret = {.channel_org = Qnil, .channel = Qnil, .block = Qnil};
VALUE rb_opt = 0;

switch (argc) {
Expand Down Expand Up @@ -534,7 +535,7 @@ static iodine_sub_args_s iodine_subscribe_args(int argc, VALUE *argv) {
rb_raise(rb_eArgError, "method accepts 1 or 2 arguments.");
return ret;
}

ret.channel_org = ret.channel;
if (ret.channel == Qnil || ret.channel == Qfalse) {
rb_raise(rb_eArgError,
"a target (:to) subject / stream / channel is required.");
Expand Down Expand Up @@ -652,7 +653,7 @@ static VALUE iodine_pubsub_subscribe(int argc, VALUE *argv, VALUE self) {
iodine_sub_add(&sub_global, sub);
fio_unlock(&sub_lock);
}
return args.channel;
return args.channel_org;
}

// clang-format off
Expand Down Expand Up @@ -682,6 +683,9 @@ static VALUE iodine_pubsub_unsubscribe(VALUE self, VALUE name) {
s_lock = &c->lock;
subs = &c->subscriptions;
}
if (TYPE(name) == T_SYMBOL)
name = rb_sym2str(name);
Check_Type(name, T_STRING);
fio_lock(s_lock);
ret = iodine_sub_unsubscribe(subs, IODINE_RSTRINFO(name));
fio_unlock(s_lock);
Expand Down
2 changes: 1 addition & 1 deletion lib/iodine/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Iodine
VERSION = '0.7.51'.freeze
VERSION = '0.7.52'.freeze
end

0 comments on commit ff0e9f8

Please sign in to comment.