rage-iodine 1.7.58 → 1.8.0

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: 7a8e82101c414c23fd04fa074937225caeabfd308ff923467076f1e79c2b93a3
4
- data.tar.gz: 3269bdbde8b4b6d2ff7c6ec6f3902e97267c8847c06252c149c384ba6017b202
3
+ metadata.gz: a5b5db0d766696d96ae2730a5d954229249dbd982bceba8fb63f184a1da62beb
4
+ data.tar.gz: 397f34465e987d8f63c253f61ee7e3efd098aa94af63a55eeff81c5c13f5b088
5
5
  SHA512:
6
- metadata.gz: 587a885ad45527a1b71542bfb4cf90291f317eb3aa1205c0137798cde8144ef8760aaf134deb0c4b1972a8639eefb02b8101ae1376a59368d7dd608b2ef7a38f
7
- data.tar.gz: 1f6c4f5c2c72c8a1e2fdb4ab9fc3117c6b23f16ddee9bc84777c192a2290df4db8025de45b3609d521c5b0f3fcab4e0227581476cad90c445ad28bd4cdc54961
6
+ metadata.gz: 00a9d42202213c7c34292b5d70074d17300736004a5d14df21bf9f1f9b933d3172335e07dbb5617f38c278a1f5073333114622dacd69870f258c65181f638cd4
7
+ data.tar.gz: bc5d84cf74cd4ee5078452fbd01ac67de8c0d2b7026d71af53136d47e862634fbf25d4910cb7e79280b77dab96bd91e76d92e1de41593e9ed2c11e0d0a2b27fe
data/ext/iodine/fio.c CHANGED
@@ -4051,18 +4051,17 @@ static int fio_watch__internal(void *uuid_, void *protocol_) {
4051
4051
  goto invalid_uuid;
4052
4052
  }
4053
4053
 
4054
- // if (!protocol) {
4055
- // fio_protocol_s *old_pr = uuid_data(uuid).protocol;
4056
- // fio_force_close_in_poll(uuid);
4057
- // fio_unlock(&uuid_data(uuid).protocol_lock);
4058
- // return 0;
4059
- // }
4060
-
4054
+ fio_protocol_s *old_pr = uuid_data(uuid).protocol;
4061
4055
  uuid_data(uuid).open = 1;
4062
4056
  uuid_data(uuid).protocol = protocol;
4063
4057
  touchfd(fio_uuid2fd(uuid));
4064
4058
  fio_unlock(&uuid_data(uuid).protocol_lock);
4065
4059
 
4060
+ if (old_pr) {
4061
+ /* close old protocol */
4062
+ fio_defer_push_task(deferred_on_close, (void *)uuid, old_pr);
4063
+ }
4064
+
4066
4065
  fio_poll_add(fio_uuid2fd(uuid));
4067
4066
  return 0;
4068
4067
 
@@ -29,18 +29,23 @@ typedef struct {
29
29
  VALUE block;
30
30
  } scheduler_protocol_s;
31
31
 
32
- static void iodine_scheduler_perform(intptr_t uuid, fio_protocol_s *fio_protocol) {
33
- scheduler_protocol_s *protocol = (scheduler_protocol_s *)fio_protocol;
34
- VALUE block = protocol->block;
35
32
 
36
- IodineCaller.call(block, call_id);
33
+ static void iodine_scheduler_task_close(intptr_t uuid, fio_protocol_s *fio_protocol) {
34
+ scheduler_protocol_s *protocol = (scheduler_protocol_s *)fio_protocol;
37
35
 
38
- IodineStore.remove(block);
36
+ IodineStore.remove(protocol->block);
39
37
  fio_free(protocol);
40
38
 
41
39
  (void)uuid;
42
40
  }
43
41
 
42
+ static void iodine_scheduler_task_perform(intptr_t uuid, fio_protocol_s *fio_protocol) {
43
+ scheduler_protocol_s *protocol = (scheduler_protocol_s *)fio_protocol;
44
+ IodineCaller.call(protocol->block, call_id);
45
+
46
+ (void)uuid;
47
+ }
48
+
44
49
  static VALUE iodine_scheduler_attach(VALUE self, VALUE r_fd, VALUE r_waittype, VALUE r_timeout) {
45
50
  Check_Type(r_fd, T_FIXNUM);
46
51
  int fd = FIX2INT(r_fd);
@@ -61,25 +66,25 @@ static VALUE iodine_scheduler_attach(VALUE self, VALUE r_fd, VALUE r_waittype, V
61
66
 
62
67
  if ((waittype & ATTACH_ON_READ_READY_CALLBACK) && (waittype & ATTACH_ON_WRITE_READY_CALLBACK)) {
63
68
  *protocol = (scheduler_protocol_s){
64
- .p.on_data = iodine_scheduler_perform,
65
- .p.on_ready = iodine_scheduler_perform,
66
- .p.on_close = noop,
69
+ .p.on_data = iodine_scheduler_task_perform,
70
+ .p.on_ready = iodine_scheduler_task_perform,
71
+ .p.on_close = iodine_scheduler_task_close,
67
72
  .p.ping = noop,
68
73
  .block = block,
69
74
  };
70
75
  } else if (waittype & ATTACH_ON_READ_READY_CALLBACK) {
71
76
  *protocol = (scheduler_protocol_s){
72
- .p.on_data = iodine_scheduler_perform,
77
+ .p.on_data = iodine_scheduler_task_perform,
73
78
  .p.on_ready = noop,
74
- .p.on_close = noop,
79
+ .p.on_close = iodine_scheduler_task_close,
75
80
  .p.ping = noop,
76
81
  .block = block,
77
82
  };
78
83
  } else if (waittype & ATTACH_ON_WRITE_READY_CALLBACK) {
79
84
  *protocol = (scheduler_protocol_s){
80
85
  .p.on_data = noop,
81
- .p.on_ready = iodine_scheduler_perform,
82
- .p.on_close = noop,
86
+ .p.on_ready = iodine_scheduler_task_perform,
87
+ .p.on_close = iodine_scheduler_task_close,
83
88
  .p.ping = noop,
84
89
  .block = block,
85
90
  };
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '1.7.58'.freeze
2
+ VERSION = '1.8.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rage-iodine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.58
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-15 00:00:00.000000000 Z
11
+ date: 2023-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -253,7 +253,7 @@ licenses:
253
253
  metadata:
254
254
  allowed_push_host: https://rubygems.org
255
255
  post_install_message: |-
256
- Thank you for installing Iodine 1.7.58.
256
+ Thank you for installing Iodine 1.8.0.
257
257
  Remember: if iodine supports your business, it's only fair to give value back (code contributions / donations).
258
258
  rdoc_options: []
259
259
  require_paths: