rage-iodine 2.0.0 → 2.1.1

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: 4221fdb6705dce60cb5e71da2644f639200571f690930fb9c428e29c4ae20032
4
- data.tar.gz: c01222eb2a55634b414c456d46319e5d2072a2ed89b258e709ea1d236cf490b9
3
+ metadata.gz: ff8127ea56a3459eae3f01e41f5ec2b11b983d4c26733141ba008e91892b0ed8
4
+ data.tar.gz: fec97c38ebb1abcdb13fb7fdd96381c93e1d0d9f6b38017eb13ab7a349df396b
5
5
  SHA512:
6
- metadata.gz: ad43ae3016c28c794926b71fd62b4f48c1362c7865f8c0118b8b5548ded1885b28c198a9d93f87a387873b4451b9f7310b545ba079cc26708521dc8c47497f7e
7
- data.tar.gz: 0067566c6d7495bc2cc4652f49278d1eaa22f5afd9764cb84b654c44fd2483f7f14ccdcddd656b4ec529ad43c4d285ba8452976b075551c9683651ace0704a5a
6
+ metadata.gz: 4cc5c93fc4180649b61ca5e9d5e8e1b2bf60630b4b9893e6c9aa68439d07c78e750d3f51446eb89fb3809864a0841b975e8c3add2422e581a44799297dcf7088
7
+ data.tar.gz: 5434a1988b2f764cf285ac6d239c5c488d371b315944a5123fc397e9f0a98af9da8d4408c0adafb67b9ac2b1937ac175f13769a1ba36dac7477eada2270c4fdd
@@ -569,7 +569,7 @@ static inline int ruby2c_response_send(iodine_http_request_handle_s *handle,
569
569
  if (body && rb_respond_to(body, close_method_id))
570
570
  IodineCaller.call(body, close_method_id);
571
571
  body = Qnil;
572
- handle->type = IODINE_HTTP_NONE;
572
+ handle->type = IODINE_HTTP_EMPTY;
573
573
  return 0;
574
574
  }
575
575
  if (TYPE(body) == T_ARRAY) {
@@ -2,6 +2,7 @@
2
2
  #include "iodine_store.h"
3
3
  #include "ruby.h"
4
4
 
5
+ #include <errno.h>
5
6
  #include <stddef.h>
6
7
  #include <stdint.h>
7
8
  #include <stdio.h>
@@ -14,6 +15,7 @@
14
15
  static ID call_id;
15
16
  static uint8_t ATTACH_ON_READ_READY_CALLBACK;
16
17
  static uint8_t ATTACH_ON_WRITE_READY_CALLBACK;
18
+ static VALUE timeout_args[1];
17
19
 
18
20
  /* *****************************************************************************
19
21
  Fiber Scheduler API
@@ -27,6 +29,7 @@ static void noop(intptr_t uuid, fio_protocol_s *protocol) {
27
29
  typedef struct {
28
30
  fio_protocol_s p;
29
31
  VALUE block;
32
+ uint8_t fulfilled;
30
33
  } scheduler_protocol_s;
31
34
 
32
35
 
@@ -41,11 +44,24 @@ static void iodine_scheduler_task_close(intptr_t uuid, fio_protocol_s *fio_proto
41
44
 
42
45
  static void iodine_scheduler_task_perform(intptr_t uuid, fio_protocol_s *fio_protocol) {
43
46
  scheduler_protocol_s *protocol = (scheduler_protocol_s *)fio_protocol;
44
- IodineCaller.call(protocol->block, call_id);
47
+
48
+ if (!protocol->fulfilled) {
49
+ IodineCaller.call(protocol->block, call_id);
50
+ protocol->fulfilled = 1;
51
+ }
45
52
 
46
53
  (void)uuid;
47
54
  }
48
55
 
56
+ static void iodine_scheduler_task_timeout(intptr_t uuid, fio_protocol_s *fio_protocol) {
57
+ scheduler_protocol_s *protocol = (scheduler_protocol_s *)fio_protocol;
58
+
59
+ if (!protocol->fulfilled) {
60
+ IodineCaller.call2(protocol->block, call_id, 1, timeout_args);
61
+ protocol->fulfilled = 1;
62
+ }
63
+ }
64
+
49
65
  static VALUE iodine_scheduler_attach(VALUE self, VALUE r_fd, VALUE r_waittype, VALUE r_timeout) {
50
66
  Check_Type(r_fd, T_FIXNUM);
51
67
  int fd = FIX2INT(r_fd);
@@ -69,7 +85,7 @@ static VALUE iodine_scheduler_attach(VALUE self, VALUE r_fd, VALUE r_waittype, V
69
85
  .p.on_data = iodine_scheduler_task_perform,
70
86
  .p.on_ready = iodine_scheduler_task_perform,
71
87
  .p.on_close = iodine_scheduler_task_close,
72
- .p.ping = noop,
88
+ .p.ping = iodine_scheduler_task_timeout,
73
89
  .block = block,
74
90
  };
75
91
  } else if (waittype & ATTACH_ON_READ_READY_CALLBACK) {
@@ -77,7 +93,7 @@ static VALUE iodine_scheduler_attach(VALUE self, VALUE r_fd, VALUE r_waittype, V
77
93
  .p.on_data = iodine_scheduler_task_perform,
78
94
  .p.on_ready = noop,
79
95
  .p.on_close = iodine_scheduler_task_close,
80
- .p.ping = noop,
96
+ .p.ping = iodine_scheduler_task_timeout,
81
97
  .block = block,
82
98
  };
83
99
  } else if (waittype & ATTACH_ON_WRITE_READY_CALLBACK) {
@@ -85,7 +101,7 @@ static VALUE iodine_scheduler_attach(VALUE self, VALUE r_fd, VALUE r_waittype, V
85
101
  .p.on_data = noop,
86
102
  .p.on_ready = iodine_scheduler_task_perform,
87
103
  .p.on_close = iodine_scheduler_task_close,
88
- .p.ping = noop,
104
+ .p.ping = iodine_scheduler_task_timeout,
89
105
  .block = block,
90
106
  };
91
107
  }
@@ -161,6 +177,7 @@ Scheduler initialization
161
177
 
162
178
  void iodine_scheduler_initialize(void) {
163
179
  call_id = rb_intern2("call", 4);
180
+ timeout_args[0] = UINT2NUM(ETIMEDOUT);
164
181
 
165
182
  VALUE SchedulerModule = rb_define_module_under(IodineModule, "Scheduler");
166
183
 
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.1.1'.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: 2.0.0
4
+ version: 2.1.1
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-10-31 00:00:00.000000000 Z
11
+ date: 2023-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake