iodine 0.7.51 → 0.7.53

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95f2aaf4cba29fd196558c215f6899964057cfb20520a4bd121e27bf4205520c
4
- data.tar.gz: 2861b7b910a9094ab2500f98964dac4551ac0028845c72522ccfc909570595ef
3
+ metadata.gz: 2d908d42070e3a604c33e2ea2cb565339779046a5c17bb9e72f85417ad5eed5c
4
+ data.tar.gz: 91ac3e4939b3ea93bcaa548d8688cf54e15841560237ec3e8e864b483add5a74
5
5
  SHA512:
6
- metadata.gz: 4cd6f2e365dc5944089bff7ca27f75b5a7912bbf7263895f75c0c6a493f225046fd86543b819646eabd5de0c60fc7f0c66e682ec760919b7faedbe9a30ef479f
7
- data.tar.gz: b50eb0aef891a06d9d649120417010b418cdd31994108b3e09dc0062c5ef623f69c9111fcdd66c063948d317711a6cce348c7ab52e35ba1dee5d43222f30cc6b
6
+ metadata.gz: 9fbf367a02283bc139ff358ca383d596c68f2eebcae65f0f4bc4d47b2bf72f06dc19dc4a2418dd5d4b6864af857d693a7041fc4e25e4f2f08e92d57868590d79
7
+ data.tar.gz: 7e9f7fbdd64a134bc2a491d6ae5c1ed41a5d5995023135678d2905b5bd9662a09b9aea7fe07a0fd70c6d4935706a8a062ee948c7fd375307d64afe9e97180bf3
data/CHANGELOG.md CHANGED
@@ -6,7 +6,21 @@ Please notice that this change log contains changes for upcoming releases as wel
6
6
 
7
7
  ## Changes:
8
8
 
9
- #### Change log v.0.7.50
9
+ #### Change log v.0.7.53 2023-01-13
10
+
11
+ **Fix**: Fixes Unix socket permission limitations, so unix sockets are not limited to the owner of the process. Credit to Patrik Rak (@raxoft) for opening issue #136.
12
+
13
+ #### Change log v.0.7.52 (2022-12-10)
14
+
15
+ **Fix**: Fixes `Iodine.unsubscribe` which failed when a symbol was supplied. Credit to Patrik Rak (@raxoft) for opening issue #134.
16
+
17
+ **Fix**: Fixes `Iodine.is_worker` which gave an incorrect answer due to a copy & paste error. Credit to Patrik Rak (@raxoft) for opening PR #133.
18
+
19
+ #### Change log v.0.7.51 (2022-12-03)
20
+
21
+ **Fix**: Fixes CPU spin error caused by an uncaught integer overflow. Credit to Alexander Pavlenko (@AlexanderPavlenko) for opening issue #132.
22
+
23
+ #### Change log v.0.7.50 (2022-10-29)
10
24
 
11
25
  **Fix**: Fixes some compatibility issues with Rack 3.0. Credit to @taku0 for opening issue #131.
12
26
 
data/ext/iodine/fio.c CHANGED
@@ -3198,18 +3198,26 @@ static intptr_t fio_unix_socket(const char *address, uint8_t server) {
3198
3198
  }
3199
3199
  if (server) {
3200
3200
  unlink(addr.sun_path);
3201
- if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
3202
- // perror("couldn't bind unix socket");
3201
+ #ifndef FIO_SOCK_AVOID_UMASK
3202
+ int org_umask = umask(0x1FF);
3203
+ int btmp = bind(fd, (struct sockaddr *)&addr, sizeof(addr));
3204
+ umask(org_umask);
3205
+ #else
3206
+ int btmp = bind(fd, (struct sockaddr *)&addr, sizeof(addr));
3207
+ #endif
3208
+ if (btmp == -1) {
3209
+ // perror("couldn't bind unix socket");
3203
3210
  close(fd);
3204
3211
  return -1;
3205
3212
  }
3213
+ /* chmod for foreign connections... if possible */
3214
+ if(chmod(addr.sun_path, 0x1FF))
3215
+ FIO_LOG_WARNING("chmod failed for %s (%d: %s)", address, errno, strerror(errno));
3206
3216
  if (listen(fd, SOMAXCONN) < 0) {
3207
3217
  // perror("couldn't start listening to unix socket");
3208
3218
  close(fd);
3209
3219
  return -1;
3210
3220
  }
3211
- /* chmod for foreign connections */
3212
- fchmod(fd, 0777);
3213
3221
  } else {
3214
3222
  if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1 &&
3215
3223
  errno != EINPROGRESS) {
@@ -6736,11 +6744,11 @@ static void fio_cluster_init(void) {
6736
6744
  if (cluster_data.name[tmp_folder_len - 1] != '/')
6737
6745
  cluster_data.name[tmp_folder_len++] = '/';
6738
6746
  }
6739
- memcpy(cluster_data.name + tmp_folder_len, "facil-io-sock-", 14);
6740
- tmp_folder_len += 14;
6747
+ memcpy(cluster_data.name + tmp_folder_len, "fio-usock-", 10);
6748
+ tmp_folder_len += 10;
6741
6749
  tmp_folder_len +=
6742
6750
  snprintf(cluster_data.name + tmp_folder_len,
6743
- FIO_CLUSTER_NAME_LIMIT - tmp_folder_len, "%d", (int)getpid());
6751
+ FIO_CLUSTER_NAME_LIMIT - tmp_folder_len, "%08x", (int)getpid() + (int)(fio_rand64() & 0xAFFFFFFF));
6744
6752
  cluster_data.name[tmp_folder_len] = 0;
6745
6753
 
6746
6754
  /* remove if existing */
data/ext/iodine/iodine.c CHANGED
@@ -312,7 +312,7 @@ static VALUE iodine_master_is(VALUE self) {
312
312
  * a single process mode (the master is also a worker), `false` otherwise.
313
313
  */
314
314
  static VALUE iodine_worker_is(VALUE self) {
315
- return fio_is_master() ? Qtrue : Qfalse;
315
+ return fio_is_worker() ? Qtrue : Qfalse;
316
316
  }
317
317
 
318
318
  /**
@@ -497,6 +497,7 @@ Ruby Connection Methods - Pub/Sub
497
497
  ***************************************************************************** */
498
498
 
499
499
  typedef struct {
500
+ VALUE channel_org;
500
501
  VALUE channel;
501
502
  VALUE block;
502
503
  fio_match_fn pattern;
@@ -506,7 +507,7 @@ typedef struct {
506
507
  /** Tests the `subscribe` Ruby arguments */
507
508
  static iodine_sub_args_s iodine_subscribe_args(int argc, VALUE *argv) {
508
509
 
509
- iodine_sub_args_s ret = {.channel = Qnil, .block = Qnil};
510
+ iodine_sub_args_s ret = {.channel_org = Qnil, .channel = Qnil, .block = Qnil};
510
511
  VALUE rb_opt = 0;
511
512
 
512
513
  switch (argc) {
@@ -534,7 +535,7 @@ static iodine_sub_args_s iodine_subscribe_args(int argc, VALUE *argv) {
534
535
  rb_raise(rb_eArgError, "method accepts 1 or 2 arguments.");
535
536
  return ret;
536
537
  }
537
-
538
+ ret.channel_org = ret.channel;
538
539
  if (ret.channel == Qnil || ret.channel == Qfalse) {
539
540
  rb_raise(rb_eArgError,
540
541
  "a target (:to) subject / stream / channel is required.");
@@ -652,7 +653,7 @@ static VALUE iodine_pubsub_subscribe(int argc, VALUE *argv, VALUE self) {
652
653
  iodine_sub_add(&sub_global, sub);
653
654
  fio_unlock(&sub_lock);
654
655
  }
655
- return args.channel;
656
+ return args.channel_org;
656
657
  }
657
658
 
658
659
  // clang-format off
@@ -682,6 +683,9 @@ static VALUE iodine_pubsub_unsubscribe(VALUE self, VALUE name) {
682
683
  s_lock = &c->lock;
683
684
  subs = &c->subscriptions;
684
685
  }
686
+ if (TYPE(name) == T_SYMBOL)
687
+ name = rb_sym2str(name);
688
+ Check_Type(name, T_STRING);
685
689
  fio_lock(s_lock);
686
690
  ret = iodine_sub_unsubscribe(subs, IODINE_RSTRINFO(name));
687
691
  fio_unlock(s_lock);
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '0.7.51'.freeze
2
+ VERSION = '0.7.53'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iodine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.51
4
+ version: 0.7.53
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-03 00:00:00.000000000 Z
11
+ date: 2023-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -246,7 +246,7 @@ licenses:
246
246
  metadata:
247
247
  allowed_push_host: https://rubygems.org
248
248
  post_install_message: |-
249
- Thank you for installing Iodine 0.7.51.
249
+ Thank you for installing Iodine 0.7.53.
250
250
  Remember: if iodine supports your business, it's only fair to give value back (code contributions / donations).
251
251
  rdoc_options: []
252
252
  require_paths: