iodine 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of iodine might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18f2abd143126a74b278a1d082c1d177d383d0de0eec4252e3c78e94e862c9d1
4
- data.tar.gz: 046fdb7171a8382d3376802514606c42dbd29f73ac6fbb224b2d87a52247dd3e
3
+ metadata.gz: 2f20b276e0e954dffafad0952b0bc11d306dc521b83ffe31fada885e1218c7b4
4
+ data.tar.gz: 1c6bd56184c5f53a0b25e5cbe1863098063887a5bc158477ce4028e441a6e19b
5
5
  SHA512:
6
- metadata.gz: 00f6ac2019eb8a83579841e30aae3b8ab65fc1af0872542fa4f94c19feea16426d8f8de30e534ea88c06770a5abe9f2e73ccb244cb5cb2abf543efee55abf2f3
7
- data.tar.gz: f494e6437a123bfef773214e6ff4a61da9ded0ea396209610d05c8d8e00d437cd17fcca1822e47bf8df3d937b2b7c4fddc6b75f4d149f77837a9c4f4d3e5a9ee
6
+ metadata.gz: 3c88074a686c61146cb6d6aabbbf293c978b5b37bb031daf69aa6ac597922655a49f7f3bfb0750ff59041b5129e8206ded38bd20caa3af411150cfd102777eb5
7
+ data.tar.gz: 5cc6299db78e362b668b7eaa9f481fd7d76bd5efdbb4e4ad0f232f5c882589e2e9897d5881f05185ef399e09b6cf3add7fca960a9c8186283224b9757fb664d7
@@ -8,6 +8,12 @@ Please notice that this change log contains changes for upcoming releases as wel
8
8
 
9
9
  #### Change log v.0.6.2
10
10
 
11
+ **Fix**: (WebSockets) fixed an issue where WebSocket message events would attempt to create a String object outside the GVL.
12
+
13
+ **Fix**: (`Iodine::Connection`) minor updated to the documentation and memory validation system.
14
+
15
+ #### Change log v.0.6.2
16
+
11
17
  **Fix**: (`Iodine::PubSub`) fixed an issue where lazy initialization would cause the shutdown process to crash if no Pub/Sub engines were ever registered (fixes an attempt to seek within an uninitialized data structure). Credit to @sj26 (Samuel Cochran) for reporting the issue.
12
18
 
13
19
  #### Change log v.0.6.1
@@ -100,14 +100,17 @@ typedef struct {
100
100
  /* a callback for the GC (marking active objects) */
101
101
  static void iodine_connection_data_mark(void *c_) {
102
102
  iodine_connection_data_s *c = c_;
103
- if (c->info.handler != Qnil) {
103
+ if (!c) {
104
+ return;
105
+ }
106
+ if (c->info.handler && c->info.handler != Qnil) {
104
107
  rb_gc_mark(c->info.handler);
105
108
  }
106
109
  if (c->info.env && c->info.env != Qnil) {
107
110
  rb_gc_mark(c->info.env);
108
111
  }
109
112
  }
110
- /* a callback for the GC (marking active objects) */
113
+ /* a callback for the GC (freeing inactive objects) */
111
114
  static void iodine_connection_data_free(void *c_) {
112
115
  iodine_connection_data_s *data = c_;
113
116
  if (spn_sub(&data->ref, 1))
@@ -129,7 +132,7 @@ const rb_data_type_t iodine_connection_data_type = {
129
132
  .dsize = iodine_connection_data_size,
130
133
  },
131
134
  .data = NULL,
132
- .flags = RUBY_TYPED_FREE_IMMEDIATELY,
135
+ // .flags = RUBY_TYPED_FREE_IMMEDIATELY,
133
136
  };
134
137
 
135
138
  /* Iodine::PubSub::Engine.allocate */
@@ -177,7 +180,9 @@ Ruby Connection Methods - write, close open? pending
177
180
  static VALUE iodine_connection_write(VALUE self, VALUE data) {
178
181
  iodine_connection_data_s *c = iodine_connection_validate_data(self);
179
182
  if (!c || sock_isclosed(c->info.uuid)) {
180
- rb_raise(rb_eIOError, "Connection closed or invalid.");
183
+ // don't throw exceptions - closed connections are unavoidable.
184
+ return Qnil;
185
+ // rb_raise(rb_eIOError, "Connection closed or invalid.");
181
186
  }
182
187
  switch (c->info.type) {
183
188
  case IODINE_CONNECTION_WEBSOCKET:
@@ -231,7 +236,7 @@ static VALUE iodine_connection_close(VALUE self) {
231
236
  iodine_connection_data_s *c = iodine_connection_validate_data(self);
232
237
  if (c && !sock_isclosed(c->info.uuid)) {
233
238
  if (c->info.type == IODINE_CONNECTION_WEBSOCKET) {
234
- websocket_close(c->info.arg);
239
+ websocket_close(c->info.arg); /* sends WebSocket close packet */
235
240
  } else {
236
241
  sock_close(c->info.uuid);
237
242
  }
@@ -250,6 +255,9 @@ static VALUE iodine_connection_is_open(VALUE self) {
250
255
  /**
251
256
  * Returns the number of pending `write` operations that need to complete
252
257
  * before the next `on_drained` callback is called.
258
+ *
259
+ * Returns -1 if the connection is closed and 0 if `on_drained` won't be
260
+ * scheduled (no pending `write`).
253
261
  */
254
262
  static VALUE iodine_connection_pending(VALUE self) {
255
263
  iodine_connection_data_s *c = iodine_connection_validate_data(self);
@@ -12,7 +12,7 @@ typedef enum {
12
12
  typedef struct {
13
13
  iodine_connection_type_e type;
14
14
  intptr_t uuid;
15
- void *arg;
15
+ void *arg; /* holds the connection pointer (ws_s / sse_s) */
16
16
  VALUE handler;
17
17
  VALUE env;
18
18
  } iodine_connection_s;
@@ -139,7 +139,7 @@ static void iodine_ws_on_message(ws_s *ws, char *data, size_t size,
139
139
  .is_text = is_text,
140
140
  .io = (VALUE)websocket_udata(ws),
141
141
  };
142
- IodineCaller.leaveGVL(iodine_ws_fire_message, &msg);
142
+ IodineCaller.enterGVL(iodine_ws_fire_message, &msg);
143
143
  }
144
144
  /**
145
145
  * The (optional) on_open callback will be called once the websocket
@@ -242,7 +242,7 @@ const rb_data_type_t iodine_pubsub_data_type = {
242
242
  .dsize = iodine_pubsub_data_size,
243
243
  },
244
244
  .data = NULL,
245
- .flags = RUBY_TYPED_FREE_IMMEDIATELY,
245
+ // .flags = RUBY_TYPED_FREE_IMMEDIATELY,
246
246
  };
247
247
 
248
248
  /* Iodine::PubSub::Engine.allocate */
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '0.6.2'.freeze
2
+ VERSION = '0.6.3'.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.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-30 00:00:00.000000000 Z
11
+ date: 2018-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -281,7 +281,7 @@ requirements:
281
281
  - Ruby >= 2.2.2 required for Rack 2.
282
282
  - Ruby >= 2.4.0 recommended.
283
283
  rubyforge_project:
284
- rubygems_version: 2.7.3
284
+ rubygems_version: 2.7.6
285
285
  signing_key:
286
286
  specification_version: 4
287
287
  summary: iodine - a fast HTTP / Websocket Server with Pub/Sub support, optimized for