iodine 0.4.1 → 0.4.2

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
  SHA1:
3
- metadata.gz: 3ae7877010acc419eed5fe07927ba5bbe3a58c4d
4
- data.tar.gz: af9499644636b46887940f5328f0204f1f654e42
3
+ metadata.gz: 375dff05d190f0bd67e614a7e17ca4f260e94931
4
+ data.tar.gz: 40214b68ddd02635863435bd25aa513165815733
5
5
  SHA512:
6
- metadata.gz: 30225e2179f074851eeb497a03e57a1d7e142b6f85c367b28efd99a4af3f4648fef1655a0fe599de95c05826931c726d4dc2fc4fa02597efce065b51d380a755
7
- data.tar.gz: 9b28f309443e33f15ea48993ba4ff8a74c83580ad2a24957c2678b4bca333f5c50e011673613f13bc7f8f8434366e043b48d648e999a0c44e9518a9e6450370d
6
+ metadata.gz: 7d65d83cb40603cb233af7be43ed1eed8151dc3530acf850b112583a06e77c026c9415e70ad4daeffe8c513a5164cdb2eddead101d35c08c2ffb60cbcae69d8a
7
+ data.tar.gz: 1910c42c7e776bd60cb564df4a09f7235a002833420cc81bcc5b17d14e3b70b7f78eaa685fbcd85058e552c249ae767bec7d3caf00478fa30979b1b146746ccb
data/CHANGELOG.md CHANGED
@@ -8,6 +8,14 @@ Please notice that this change log contains changes for upcoming releases as wel
8
8
 
9
9
  ***
10
10
 
11
+ #### Change log v.0.4.2
12
+
13
+ **Fix**: fixed an issue where Websocket `ping` timeouts were being ignored for the default `Iodine::Rack` server, causing the default (40 seconds) to persist over specified valued.
14
+
15
+ **Fix**: fixed a possible issue with highjacking which might cause the server to hang.
16
+
17
+ ***
18
+
11
19
  #### Change log v.0.4.1
12
20
 
13
21
  **Fix**: postpone warmup in fear of abuse and collisions when using `fork`. i.e., during warmup, an application might perform actions that conflict with `fork` and worker initialization, such as creating a database connection pool during warmup, or maybe spawning a thread. Now `warmup` is postponed until *after* worker processes are up and running, resulting in a per-process warmup rather than a per-cluster warmup.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright: Boaz segev, 2016-2017
2
+ Copyright: Boaz segev, 2017
3
3
  License: MIT
4
4
 
5
5
  Feel free to copy, use and enjoy according to the license provided.
data/ext/iodine/iodine.c CHANGED
@@ -286,7 +286,7 @@ static int iodine_review_rack_app(void) {
286
286
  rb_hash_aset(opt, ID2SYM(rb_intern("public")),
287
287
  rb_ivar_get(rack, rb_intern("@public")));
288
288
  rb_hash_aset(opt, ID2SYM(rb_intern("ping")),
289
- rb_ivar_get(rack, rb_intern("@ping")));
289
+ rb_ivar_get(rack, rb_intern("@ws_timeout")));
290
290
  rb_hash_aset(opt, ID2SYM(rb_intern("timeout")),
291
291
  rb_ivar_get(rack, rb_intern("@ws_timeout")));
292
292
  if (rb_funcall2(Iodine, rb_intern("listen2http"), 1, &opt) == Qfalse)
@@ -152,8 +152,8 @@ static void redis_on_data(intptr_t uuid, protocol_s *pr) {
152
152
  continue; /* while loop */
153
153
  }
154
154
  if (msg) {
155
- if (!r->authenticated) {
156
- r->authenticated = 1;
155
+ if (r->authenticated) {
156
+ r->authenticated--;
157
157
  if (msg->type != RESP_OK) {
158
158
  if (msg->type == RESP_ERR) {
159
159
  fprintf(stderr,
@@ -210,6 +210,7 @@ static void redis_on_open(intptr_t uuid, protocol_s *pr, void *d) {
210
210
  redis_protocol_s *r = (void *)pr;
211
211
  facil_set_timeout(uuid, r->settings->ping);
212
212
  if (r->settings->auth) {
213
+ r->authenticated = 1;
213
214
  size_t n_len = ul2a(NULL, r->settings->auth_len);
214
215
  char *t =
215
216
  malloc(r->settings->auth_len + 20 + n_len); /* 19 is probably enough */
@@ -225,7 +226,7 @@ static void redis_on_open(intptr_t uuid, protocol_s *pr, void *d) {
225
226
  .length = (19 + n_len + r->settings->auth_len), .move = 1);
226
227
 
227
228
  } else
228
- r->authenticated = 1;
229
+ r->authenticated = 0;
229
230
  r->settings->on_open(uuid, r->settings->udata);
230
231
  (void)d;
231
232
  }
@@ -341,6 +341,26 @@ pubsub_engine_s *redis_engine_create(struct redis_engine_create_args a) {
341
341
  return (pubsub_engine_s *)e;
342
342
  }
343
343
 
344
+ /**
345
+ See the {pubsub.h} file for documentation about engines.
346
+
347
+ function names speak for themselves ;-)
348
+ */
349
+ void redis_engine_destroy(pubsub_engine_s *engine) {
350
+ redis_engine_s *r = (redis_engine_s *)engine;
351
+
352
+ spn_lock(&r->lock);
353
+ callbacks_s *cb;
354
+ fio_list_for_each(callbacks_s, node, cb, r->callbacks) free(cb);
355
+ sock_force_close(r->pub);
356
+ sock_force_close(r->sub);
357
+
358
+ r->active = 0;
359
+ if (dealloc_engine(r))
360
+ return;
361
+ spn_unlock(&r->lock);
362
+ }
363
+
344
364
  /* *****************************************************************************
345
365
  Sending Data
346
366
  ***************************************************************************** */
@@ -376,23 +396,3 @@ intptr_t redis_engine_send(pubsub_engine_s *e, resp_object_s *data,
376
396
  schedule_pub_send(r, r->pub);
377
397
  return 0;
378
398
  }
379
-
380
- /**
381
- See the {pubsub.h} file for documentation about engines.
382
-
383
- function names speak for themselves ;-)
384
- */
385
- void redis_engine_destroy(pubsub_engine_s *engine) {
386
- redis_engine_s *r = (redis_engine_s *)engine;
387
-
388
- spn_lock(&r->lock);
389
- callbacks_s *cb;
390
- fio_list_for_each(callbacks_s, node, cb, r->callbacks) free(cb);
391
- sock_force_close(r->pub);
392
- sock_force_close(r->sub);
393
-
394
- r->active = 0;
395
- if (dealloc_engine(r))
396
- return;
397
- spn_unlock(&r->lock);
398
- }
data/ext/iodine/sock.c CHANGED
@@ -990,13 +990,15 @@ ssize_t sock_flush(intptr_t uuid) {
990
990
  if (validate_uuid(uuid) || !fdinfo(fd).open)
991
991
  return -1;
992
992
  ssize_t ret;
993
+ uint8_t touch = 0;
993
994
  lock_fd(fd);
994
995
  sock_rw_hook_s *rw;
995
996
  retry:
996
997
  rw = fdinfo(fd).rw_hooks;
997
998
  unlock_fd(fd);
998
999
  while ((ret = rw->flush(fd)) > 0)
999
- ;
1000
+ if (ret > 0)
1001
+ touch = 1;
1000
1002
  if (ret == -1) {
1001
1003
  if (errno == EINTR)
1002
1004
  goto retry;
@@ -1008,7 +1010,7 @@ retry:
1008
1010
  lock_fd(fd);
1009
1011
  while (fdinfo(fd).packet && (ret = fdinfo(fd).packet->metadata.write_func(
1010
1012
  fd, fdinfo(fd).packet)) > 0)
1011
- ;
1013
+ touch = 1;
1012
1014
  if (ret == -1) {
1013
1015
  if (errno == EINTR)
1014
1016
  goto retry;
@@ -1021,7 +1023,8 @@ retry:
1021
1023
  goto error;
1022
1024
  finish:
1023
1025
  unlock_fd(fd);
1024
- sock_touch(uuid);
1026
+ if (touch)
1027
+ sock_touch(uuid);
1025
1028
  return 0;
1026
1029
  error:
1027
1030
  unlock_fd(fd);
@@ -1037,7 +1040,8 @@ error:
1037
1040
  after all the data was sent. This is a "busy" wait, polling isn't performed.
1038
1041
  */
1039
1042
  void sock_flush_strong(intptr_t uuid) {
1040
- while (sock_flush(uuid) == 0)
1043
+ errno = 0;
1044
+ while (sock_flush(uuid) == 0 && !errno)
1041
1045
  ;
1042
1046
  }
1043
1047
  /**
@@ -1,3 +1,3 @@
1
1
  module Iodine
2
- VERSION = '0.4.1'.freeze
2
+ VERSION = '0.4.2'.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.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-25 00:00:00.000000000 Z
11
+ date: 2017-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack