kgio 2.7.2 → 2.7.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.
- data/GIT-VERSION-GEN +1 -1
- data/HACKING +15 -0
- data/ext/kgio/autopush.c +1 -0
- data/ext/kgio/missing_accept4.h +1 -1
- data/ext/kgio/read_write.c +13 -0
- data/test/test_autopush.rb +2 -1
- data/test/test_default_wait.rb +2 -2
- data/test/test_poll.rb +4 -1
- metadata +5 -5
data/GIT-VERSION-GEN
CHANGED
data/HACKING
CHANGED
@@ -61,3 +61,18 @@ Without RubyGems (via setup.rb):
|
|
61
61
|
|
62
62
|
It is not at all recommended to mix a RubyGems installation with an
|
63
63
|
installation done without RubyGems, however.
|
64
|
+
|
65
|
+
=== Tests
|
66
|
+
|
67
|
+
We use GNU make to run tests in parallel. test/unit/parallel didn't
|
68
|
+
exist for old versions of Ruby before 1.9.3. Users of GNU-based systems
|
69
|
+
(such as GNU/Linux) usually have GNU make installed as "make" instead of
|
70
|
+
"gmake".
|
71
|
+
|
72
|
+
Running the entire test suite with 4 tests in parallel:
|
73
|
+
|
74
|
+
gmake -j4 test
|
75
|
+
|
76
|
+
Running just one unit test:
|
77
|
+
|
78
|
+
gmake test/test_poll.rb
|
data/ext/kgio/autopush.c
CHANGED
data/ext/kgio/missing_accept4.h
CHANGED
data/ext/kgio/read_write.c
CHANGED
@@ -13,8 +13,18 @@ static ID id_set_backtrace;
|
|
13
13
|
#if defined(__linux__) && ! defined(USE_MSG_DONTWAIT)
|
14
14
|
# define USE_MSG_DONTWAIT
|
15
15
|
static const int peek_flags = MSG_DONTWAIT|MSG_PEEK;
|
16
|
+
|
17
|
+
/* we don't need these variants, we call kgio_autopush_send/recv directly */
|
18
|
+
static inline void kgio_autopush_read(VALUE io) { }
|
19
|
+
static inline void kgio_autopush_write(VALUE io) { }
|
20
|
+
|
16
21
|
#else
|
17
22
|
static const int peek_flags = MSG_PEEK;
|
23
|
+
# include <netinet/tcp.h>
|
24
|
+
# if defined(TCP_NOPUSH)
|
25
|
+
static inline void kgio_autopush_read(VALUE io) { kgio_autopush_recv(io); }
|
26
|
+
static inline void kgio_autopush_write(VALUE io) { kgio_autopush_send(io); }
|
27
|
+
# endif
|
18
28
|
#endif
|
19
29
|
|
20
30
|
NORETURN(static void raise_empty_bt(VALUE, const char *));
|
@@ -112,6 +122,7 @@ static VALUE my_read(int io_wait, int argc, VALUE *argv, VALUE io)
|
|
112
122
|
long n;
|
113
123
|
|
114
124
|
prepare_read(&a, argc, argv, io);
|
125
|
+
kgio_autopush_read(io);
|
115
126
|
|
116
127
|
if (a.len > 0) {
|
117
128
|
set_nonblocking(a.fd);
|
@@ -357,6 +368,8 @@ retry:
|
|
357
368
|
n = (long)write(a.fd, a.ptr, a.len);
|
358
369
|
if (write_check(&a, n, "write", io_wait) != 0)
|
359
370
|
goto retry;
|
371
|
+
if (TYPE(a.buf) != T_SYMBOL)
|
372
|
+
kgio_autopush_write(io);
|
360
373
|
return a.buf;
|
361
374
|
}
|
362
375
|
|
data/test/test_autopush.rb
CHANGED
@@ -38,7 +38,8 @@ class TestAutopush < Test::Unit::TestCase
|
|
38
38
|
assert_nothing_raised { s.kgio_write 'asdf' }
|
39
39
|
assert_equal :wait_readable, s.kgio_tryread(1)
|
40
40
|
assert s.kgio_autopush?
|
41
|
-
|
41
|
+
val = s.getsockopt(Socket::IPPROTO_TCP, opt).unpack('i')[0]
|
42
|
+
assert_operator val, :>, 0, "#{opt}=#{val} (#{RUBY_PLATFORM})"
|
42
43
|
end
|
43
44
|
|
44
45
|
def test_autopush_true_unix
|
data/test/test_default_wait.rb
CHANGED
@@ -24,7 +24,7 @@ class TestDefaultWait < Test::Unit::TestCase
|
|
24
24
|
t0 = Time.now
|
25
25
|
assert_nil a.kgio_wait_readable(1.1)
|
26
26
|
diff = Time.now - t0
|
27
|
-
assert_in_delta diff, 1.1, 0.
|
27
|
+
assert_in_delta diff, 1.1, 0.2
|
28
28
|
|
29
29
|
b.kgio_write '.'
|
30
30
|
assert_equal a, a.kgio_wait_readable(1.1)
|
@@ -37,7 +37,7 @@ class TestDefaultWait < Test::Unit::TestCase
|
|
37
37
|
t0 = Time.now
|
38
38
|
assert_nil b.kgio_wait_writable(1.1)
|
39
39
|
diff = Time.now - t0
|
40
|
-
assert_in_delta diff, 1.1, 0.
|
40
|
+
assert_in_delta diff, 1.1, 0.2
|
41
41
|
|
42
42
|
a.kgio_read(16384)
|
43
43
|
assert_equal b, b.kgio_wait_writable(1.1)
|
data/test/test_poll.rb
CHANGED
@@ -58,7 +58,10 @@ class TestPoll < Test::Unit::TestCase
|
|
58
58
|
res = nil
|
59
59
|
thr = Thread.new { sleep 0.100; Process.kill(:USR1, $$) }
|
60
60
|
t0 = Time.now
|
61
|
-
assert_raises(IOError)
|
61
|
+
assert_raises(IOError) do
|
62
|
+
result = Kgio.poll({@rd => Kgio::POLLIN})
|
63
|
+
result.each_key { |io| io.read_nonblock(1) }
|
64
|
+
end
|
62
65
|
diff = Time.now - t0
|
63
66
|
thr.join
|
64
67
|
assert diff >= 0.010, "diff=#{diff}"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kgio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 2.7.
|
9
|
+
- 3
|
10
|
+
version: 2.7.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- kgio hackers
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-
|
18
|
+
date: 2012-03-15 00:00:00 Z
|
19
19
|
dependencies: []
|
20
20
|
|
21
21
|
description: |-
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
requirements: []
|
145
145
|
|
146
146
|
rubyforge_project: rainbows
|
147
|
-
rubygems_version: 1.8.
|
147
|
+
rubygems_version: 1.8.17
|
148
148
|
signing_key:
|
149
149
|
specification_version: 3
|
150
150
|
summary: kinder, gentler I/O for Ruby
|