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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +782 -782
- data/examples/config.ru +3 -0
- data/examples/rack3.ru +12 -0
- data/ext/iodine_ext/extconf.rb +1 -0
- data/ext/iodine_ext/fio.c +5 -3
- data/ext/iodine_ext/http1_parser.h +1065 -103
- data/ext/iodine_ext/iodine_connection.c +10 -6
- data/ext/iodine_ext/iodine_http.c +23 -11
- data/ext/iodine_ext/websocket_parser.h +1 -0
- data/ext/iodine_ext/websockets.c +28 -11
- data/lib/iodine/version.rb +1 -1
- data/lib/rack/handler/iodine.rb +1 -1
- metadata +4 -4
- data/.travis.yml +0 -32
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
|
+
}
|
data/ext/iodine_ext/extconf.rb
CHANGED
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
|
-
|
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) &&
|
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;
|