isomorfeus-iodine 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
data/examples/config.ru CHANGED
@@ -12,6 +12,9 @@
12
12
  #
13
13
  # ab -c 2000 -t 5 -n 1000000 -k http://127.0.0.1:3000/
14
14
  # wrk -c2000 -d5 -t12 http://localhost:3000/
15
+ #
16
+ # Test websocket echo using the browser. For example:
17
+ # ws = new WebSocket("ws://localhost:3000"); ws.onmessage = function(e) {console.log("Got message!"); console.log(e.data);}; ws.onclose = function(e) {console.log("closed")}; ws.onopen = function(e) {ws.send("hi");};
15
18
 
16
19
 
17
20
  # A simple router - Checks for Websocket Upgrade and answers HTTP.
data/examples/rack3.ru ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ # adjusted from the code suggested by @taku0 (GitHub issue #131)
4
+ require 'rack'
5
+ require 'iodine'
6
+
7
+ run { |env|
8
+ response = Rack::Response.new(nil, 204)
9
+ response.set_cookie('aaa', 'aaa')
10
+ response.set_cookie('bbb', 'bbb')
11
+ response.finish
12
+ }
@@ -1,4 +1,5 @@
1
1
  require 'mkmf'
2
+ require 'fileutils'
2
3
 
3
4
  WIN_PATTERNS = [
4
5
  /bccwin/i,
data/ext/iodine_ext/fio.c CHANGED
@@ -1025,7 +1025,7 @@ static void fio_defer_thread_wait(void) {
1025
1025
  if (fio_defer_has_queue())
1026
1026
  pthread_setspecific(static_throttle_key, (void *)1);
1027
1027
  else if (static_throttle < FIO_DEFER_THROTTLE_LIMIT)
1028
- pthread_setspecific(static_throttle_key, (void *)(static_throttle << 1));
1028
+ pthread_setspecific(static_throttle_key, (void *)((static_throttle << 1) | 1));
1029
1029
  }
1030
1030
  }
1031
1031
 
@@ -3689,7 +3689,8 @@ closed:
3689
3689
  return -1;
3690
3690
 
3691
3691
  flush_rw_hook:
3692
- flushed = uuid_data(uuid).rw_hooks->flush(uuid, uuid_data(uuid).rw_udata);
3692
+ if(uuid_data(uuid).rw_hooks)
3693
+ flushed = uuid_data(uuid).rw_hooks->flush(uuid, uuid_data(uuid).rw_udata);
3693
3694
  fio_unlock(&uuid_data(uuid).sock_lock);
3694
3695
  if (!flushed)
3695
3696
  return 0;
@@ -3749,7 +3750,8 @@ size_t fio_flush_all(void) {
3749
3750
  return 0;
3750
3751
  size_t count = 0;
3751
3752
  for (uintptr_t i = 0; i <= fio_data->max_protocol_fd; ++i) {
3752
- if ((fd_data(i).open || fd_data(i).packet) && fio_flush(fd2uuid(i)) > 0)
3753
+ if ((fd_data(i).open || fd_data(i).packet) &&
3754
+ fd_data(i).rw_hooks && fio_flush(fd2uuid(i)) > 0)
3753
3755
  ++count;
3754
3756
  }
3755
3757
  return count;