cool.io 1.9.2 → 1.9.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5cdd11354b2fc68835f7380b7f529a5c41c29280dd489287eb99fbc605978f18
4
- data.tar.gz: 51e173aadc18fdd12915648b7ac58553ab0b22c13be146e2273d507135cefe58
3
+ metadata.gz: f15a89de41069e6ccb37eb28befd01d601851ae1bb9ee2a5081e1c26e0bcc8da
4
+ data.tar.gz: de69fe197c029bbb4438e2e1c751580712ecc1f1b8326803d2089b738d3f74cc
5
5
  SHA512:
6
- metadata.gz: 4449d8f0cec3c081e3ff3625351d66e1eb19ec4cdc23d547a4c2862d0b3a25e8a71bf43eb803559b3758ed284bd3f4a4f5e6008b04e490530604c6cc6551a9eb
7
- data.tar.gz: 7607bab107f686eb8f1a16bc013f0a78815238fc1063de51d75b3e6299f00384583bd311de2841ea1d5bd43e4b72eaad5b43f3f22face9bd327ca9c0629f1a0f
6
+ metadata.gz: c88454501a2b042515b0571a729bac9a829ed7af72be377caf5ab6db08f90bb48adb1e19a69dee1b38eb1c77df9c084c88faa19d0077503c85a965e6c0c556ac
7
+ data.tar.gz: 8fd2af4f085bbb253df79cb8c9c685df97c5dc233f4be4891cef796120e9b265676e6fa4fe7c39b0b3b77447c000e41cbb1bc66b8939869e8747ac270619c436
@@ -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}}
@@ -20,35 +17,27 @@ jobs:
20
17
  os:
21
18
  - ubuntu
22
19
  - macos
23
- - windows
24
20
 
25
21
  ruby:
26
- - "3.0"
27
- - "3.1"
28
22
  - "3.2"
29
23
  - "3.3"
30
- - "head"
24
+ - "3.4"
25
+ - "4.0"
31
26
 
32
27
  experimental: [false]
33
28
 
34
- # include:
35
- # - os: ubuntu
36
- # ruby: truffleruby
37
- # experimental: true
38
- # - os: ubuntu
39
- # ruby: jruby
40
- # experimental: true
41
- # - os: ubuntu
42
- # ruby: head
43
- # experimental: true
29
+ include:
30
+ - os: ubuntu
31
+ ruby: head
32
+ experimental: true
44
33
 
45
34
  steps:
46
- - uses: actions/checkout@v3
35
+ - uses: actions/checkout@v6
47
36
  - uses: ruby/setup-ruby@v1
48
37
  with:
49
38
  ruby-version: ${{matrix.ruby}}
50
39
  bundler-cache: true
51
40
 
52
41
  - name: Run tests
53
- timeout-minutes: 2
42
+ timeout-minutes: 10
54
43
  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
- free(buf);
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
- free(tmp);
494
+ xfree(tmp);
495
495
  }
496
496
 
497
497
  buf->pool_tail = 0;
@@ -26,20 +26,15 @@
26
26
 
27
27
  #define Watcher_Detach(watcher_type, watcher) \
28
28
  struct Coolio_Watcher *watcher_data; \
29
- struct Coolio_Loop *loop_data; \
30
29
  \
31
30
  watcher_data = Coolio_Watcher_ptr(watcher); \
32
31
  \
33
32
  if(watcher_data->loop == Qnil) \
34
33
  rb_raise(rb_eRuntimeError, "not attached to a loop"); \
35
34
  \
36
- if (watcher_data->enabled == 0) { \
37
- /* Ignore because watcher was already detached. */ \
38
- return Qnil; \
35
+ if (watcher_data->enabled) { \
36
+ rb_funcall(watcher, rb_intern("disable"), 0); \
39
37
  } \
40
- loop_data = Coolio_Loop_ptr(watcher_data->loop); \
41
- \
42
- ev_##watcher_type##_stop(loop_data->ev_loop, &watcher_data->event_types.ev_##watcher_type); \
43
38
  rb_call_super(0, 0)
44
39
 
45
40
  #define Watcher_Enable(watcher_type, watcher) \
@@ -66,10 +61,10 @@
66
61
  if(watcher_data->loop == Qnil) \
67
62
  rb_raise(rb_eRuntimeError, "not attached to a loop"); \
68
63
  \
69
- rb_call_super(0, 0); \
70
- \
71
- loop_data = Coolio_Loop_ptr(watcher_data->loop); \
72
- \
73
- ev_##watcher_type##_stop(loop_data->ev_loop, &watcher_data->event_types.ev_##watcher_type)
64
+ if (watcher_data->enabled) { \
65
+ loop_data = Coolio_Loop_ptr(watcher_data->loop); \
66
+ ev_##watcher_type##_stop(loop_data->ev_loop, &watcher_data->event_types.ev_##watcher_type); \
67
+ } \
68
+ rb_call_super(0, 0);
74
69
 
75
70
  #endif
@@ -1,5 +1,5 @@
1
1
  module Coolio
2
- VERSION = "1.9.2"
2
+ VERSION = "1.9.4"
3
3
 
4
4
  def self.version
5
5
  VERSION
@@ -47,4 +47,49 @@ describe Cool.io::Loop do
47
47
  end
48
48
  }.not_to raise_error
49
49
  end
50
+
51
+ class HttpHandler < Coolio::IO
52
+ RESPONSE = "HTTP/1.1 200 OK\r\nContent-Length: 1024\r\nConnection: close\r\n\r\n" + ("X" * 1024)
53
+
54
+ def on_connect
55
+ end
56
+
57
+ def on_read(data)
58
+ write(RESPONSE)
59
+ end
60
+
61
+ def on_write_complete
62
+ close
63
+ end
64
+ end
65
+
66
+ # https://github.com/socketry/cool.io/issues/89
67
+ it "does not cause memory leaks" do
68
+ port = 18989
69
+ loop = Coolio::Loop.default
70
+
71
+ server = Coolio::TCPServer.new('127.0.0.1', port, HttpHandler)
72
+ server.attach(loop)
73
+
74
+ event_thread = Thread.new { loop.run }
75
+
76
+ request = "GET / HTTP/1.1\r\nHost: localhost\r\n\r\n"
77
+
78
+ 10.times do |iteration|
79
+ begin
80
+ sock = TCPSocket.new('127.0.0.1', port)
81
+ sock.write(request)
82
+ sock.read
83
+ sock.close
84
+ rescue => e
85
+ sleep 0.01
86
+ retry
87
+ end
88
+ end
89
+
90
+ server.close
91
+ event_thread.join
92
+
93
+ expect(loop.watchers).to be_empty
94
+ end
50
95
  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.2
4
+ version: 1.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Arcieri
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0'
171
171
  requirements: []
172
- rubygems_version: 4.0.3
172
+ rubygems_version: 4.0.6
173
173
  specification_version: 4
174
174
  summary: A cool framework for doing high performance I/O in Ruby
175
175
  test_files: