cool.io 1.9.1 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test.yaml +8 -20
- data/ext/cool.io/buffer.c +2 -2
- data/ext/cool.io/loop.c +6 -0
- data/ext/cool.io/watcher.h +4 -0
- data/lib/cool.io/version.rb +1 -1
- data/spec/detach_race_condition_spec.rb +50 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 744af9f4092900f46b6db222fadf805f4fe107fb8f3c5c0a5c9661508d957ac5
|
|
4
|
+
data.tar.gz: 594ae4eb024a1c4519ec912859126b5e739f52cc3bdfab1f93ae8fc9cbf7610f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5b27d1af86f5647d9409b7b394d5ed9f2c85de9b68ab88d1d6363ca94aa05d84326f4feed754319f8409b371c53c61cb814292f7849618d806235b7e6de65007
|
|
7
|
+
data.tar.gz: 58839f3800e0aa902f4c0b60b7b23eff2414cb1c34a14df688b318e4b1d31151ce7dfcc6a8e9d7b1d818d5160cf858b0a8a533ee5d1adf1c195d00baa7f50d43
|
data/.github/workflows/test.yaml
CHANGED
|
@@ -5,9 +5,6 @@ on: [push, pull_request]
|
|
|
5
5
|
permissions:
|
|
6
6
|
contents: read
|
|
7
7
|
|
|
8
|
-
env:
|
|
9
|
-
CONSOLE_OUTPUT: XTerm
|
|
10
|
-
|
|
11
8
|
jobs:
|
|
12
9
|
test:
|
|
13
10
|
name: ${{matrix.ruby}} on ${{matrix.os}}
|
|
@@ -15,40 +12,31 @@ jobs:
|
|
|
15
12
|
continue-on-error: ${{matrix.experimental}}
|
|
16
13
|
|
|
17
14
|
strategy:
|
|
18
|
-
fail-fast: false
|
|
19
15
|
matrix:
|
|
20
16
|
os:
|
|
21
17
|
- ubuntu
|
|
22
18
|
- macos
|
|
23
|
-
- windows
|
|
24
19
|
|
|
25
20
|
ruby:
|
|
26
|
-
- "3.0"
|
|
27
|
-
- "3.1"
|
|
28
21
|
- "3.2"
|
|
29
22
|
- "3.3"
|
|
30
|
-
- "
|
|
23
|
+
- "3.4"
|
|
24
|
+
- "4.0"
|
|
31
25
|
|
|
32
26
|
experimental: [false]
|
|
33
27
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# - os: ubuntu
|
|
39
|
-
# ruby: jruby
|
|
40
|
-
# experimental: true
|
|
41
|
-
# - os: ubuntu
|
|
42
|
-
# ruby: head
|
|
43
|
-
# experimental: true
|
|
28
|
+
include:
|
|
29
|
+
- os: ubuntu
|
|
30
|
+
ruby: head
|
|
31
|
+
experimental: true
|
|
44
32
|
|
|
45
33
|
steps:
|
|
46
|
-
- uses: actions/checkout@
|
|
34
|
+
- uses: actions/checkout@v6
|
|
47
35
|
- uses: ruby/setup-ruby@v1
|
|
48
36
|
with:
|
|
49
37
|
ruby-version: ${{matrix.ruby}}
|
|
50
38
|
bundler-cache: true
|
|
51
39
|
|
|
52
40
|
- name: Run tests
|
|
53
|
-
timeout-minutes:
|
|
41
|
+
timeout-minutes: 10
|
|
54
42
|
run: bundle exec rake
|
data/ext/cool.io/buffer.c
CHANGED
|
@@ -479,7 +479,7 @@ buffer_free(struct buffer * buf)
|
|
|
479
479
|
buffer_clear(buf);
|
|
480
480
|
buffer_free_pool(buf);
|
|
481
481
|
|
|
482
|
-
|
|
482
|
+
xfree(buf);
|
|
483
483
|
}
|
|
484
484
|
|
|
485
485
|
/* Free the memory pool */
|
|
@@ -491,7 +491,7 @@ buffer_free_pool(struct buffer * buf)
|
|
|
491
491
|
while (buf->pool_head) {
|
|
492
492
|
tmp = buf->pool_head;
|
|
493
493
|
buf->pool_head = tmp->next;
|
|
494
|
-
|
|
494
|
+
xfree(tmp);
|
|
495
495
|
}
|
|
496
496
|
|
|
497
497
|
buf->pool_tail = 0;
|
data/ext/cool.io/loop.c
CHANGED
|
@@ -113,6 +113,12 @@ void Coolio_Loop_process_event(VALUE watcher, int revents)
|
|
|
113
113
|
/* The Global VM lock isn't held right now, but hopefully
|
|
114
114
|
* we can still do this safely */
|
|
115
115
|
watcher_data = Coolio_Watcher_ptr(watcher);
|
|
116
|
+
|
|
117
|
+
if (watcher_data->enabled == 0) {
|
|
118
|
+
/* Ignore event because watcher was already detached. */
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
116
122
|
loop_data = Coolio_Loop_ptr(watcher_data->loop);
|
|
117
123
|
|
|
118
124
|
/* Well, what better place to explain how this all works than
|
data/ext/cool.io/watcher.h
CHANGED
|
@@ -33,6 +33,10 @@
|
|
|
33
33
|
if(watcher_data->loop == Qnil) \
|
|
34
34
|
rb_raise(rb_eRuntimeError, "not attached to a loop"); \
|
|
35
35
|
\
|
|
36
|
+
if (watcher_data->enabled == 0) { \
|
|
37
|
+
/* Ignore because watcher was already detached. */ \
|
|
38
|
+
return Qnil; \
|
|
39
|
+
} \
|
|
36
40
|
loop_data = Coolio_Loop_ptr(watcher_data->loop); \
|
|
37
41
|
\
|
|
38
42
|
ev_##watcher_type##_stop(loop_data->ev_loop, &watcher_data->event_types.ev_##watcher_type); \
|
data/lib/cool.io/version.rb
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Cool.io::Loop do
|
|
4
|
+
class Victim < Cool.io::IOWatcher
|
|
5
|
+
def initialize(io)
|
|
6
|
+
super
|
|
7
|
+
@io = io
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def on_readable
|
|
11
|
+
begin
|
|
12
|
+
@io.read_nonblock(1024)
|
|
13
|
+
rescue IO::WaitReadable, EOFError
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# https://github.com/socketry/cool.io/issues/87
|
|
19
|
+
it "does not raise TypeError when a watcher is detached while an event is pending" do
|
|
20
|
+
loop = Cool.io::Loop.default
|
|
21
|
+
|
|
22
|
+
iterations = 200
|
|
23
|
+
|
|
24
|
+
expect {
|
|
25
|
+
iterations.times do
|
|
26
|
+
r_victim, w_victim = IO.pipe
|
|
27
|
+
victim_watcher = Victim.new(r_victim)
|
|
28
|
+
victim_watcher.attach(loop)
|
|
29
|
+
|
|
30
|
+
t1 = Thread.new do
|
|
31
|
+
sleep 0.01
|
|
32
|
+
w_victim.write("dummy\n")
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
t2 = Thread.new do
|
|
36
|
+
sleep 0.01
|
|
37
|
+
victim_watcher.detach
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
loop.run_once
|
|
41
|
+
|
|
42
|
+
t1.join
|
|
43
|
+
t2.join
|
|
44
|
+
|
|
45
|
+
r_victim.close
|
|
46
|
+
w_victim.close
|
|
47
|
+
end
|
|
48
|
+
}.not_to raise_error
|
|
49
|
+
end
|
|
50
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cool.io
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tony Arcieri
|
|
@@ -140,6 +140,7 @@ files:
|
|
|
140
140
|
- libev_ruby_gil.diff
|
|
141
141
|
- libev_win_select.diff
|
|
142
142
|
- spec/async_watcher_spec.rb
|
|
143
|
+
- spec/detach_race_condition_spec.rb
|
|
143
144
|
- spec/dns_spec.rb
|
|
144
145
|
- spec/iobuffer_spec.rb
|
|
145
146
|
- spec/spec_helper.rb
|
|
@@ -168,11 +169,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
168
169
|
- !ruby/object:Gem::Version
|
|
169
170
|
version: '0'
|
|
170
171
|
requirements: []
|
|
171
|
-
rubygems_version: 4.0.
|
|
172
|
+
rubygems_version: 4.0.3
|
|
172
173
|
specification_version: 4
|
|
173
174
|
summary: A cool framework for doing high performance I/O in Ruby
|
|
174
175
|
test_files:
|
|
175
176
|
- spec/async_watcher_spec.rb
|
|
177
|
+
- spec/detach_race_condition_spec.rb
|
|
176
178
|
- spec/dns_spec.rb
|
|
177
179
|
- spec/iobuffer_spec.rb
|
|
178
180
|
- spec/spec_helper.rb
|