kgio 2.7.2 → 2.7.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
3
  GVF=GIT-VERSION-FILE
4
- DEF_VER=v2.7.2.GIT
4
+ DEF_VER=v2.7.3.GIT
5
5
 
6
6
  LF='
7
7
  '
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
@@ -240,6 +240,7 @@ static void push_pending_data(VALUE io)
240
240
  }
241
241
  #else /* !KGIO_NOPUSH */
242
242
  void kgio_autopush_recv(VALUE io){}
243
+ void kgio_autopush_send(VALUE io){}
243
244
  void init_kgio_autopush(void)
244
245
  {
245
246
  }
@@ -1,4 +1,4 @@
1
- #ifndef HAVE_ACCEPT4
1
+ #if !defined(HAVE_ACCEPT4) || !defined(SOCK_CLOEXEC) || !defined(SOCK_NONBLOCK)
2
2
  # ifndef _GNU_SOURCE
3
3
  # define _GNU_SOURCE
4
4
  # endif
@@ -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
 
@@ -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
- assert_equal 1, s.getsockopt(Socket::IPPROTO_TCP, opt).unpack('i')[0]
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
@@ -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.05
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.05
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)
@@ -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) { Kgio.poll({@rd => Kgio::POLLIN}) }
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: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 7
9
- - 2
10
- version: 2.7.2
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-01-08 00:00:00 Z
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.11
147
+ rubygems_version: 1.8.17
148
148
  signing_key:
149
149
  specification_version: 3
150
150
  summary: kinder, gentler I/O for Ruby