kgio 1.1.0 → 1.2.0
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/GNUmakefile +2 -2
- data/ext/kgio/accept.c +371 -0
- data/ext/kgio/connect.c +256 -0
- data/ext/kgio/kgio.h +40 -0
- data/ext/kgio/kgio_ext.c +6 -1090
- data/ext/kgio/missing/accept4.h +7 -13
- data/ext/kgio/read_write.c +387 -0
- data/ext/kgio/sock_for_fd.h +3 -0
- data/ext/kgio/wait.c +115 -0
- data/lib/kgio.rb +18 -0
- data/test/lib_read_write.rb +22 -4
- metadata +9 -4
data/lib/kgio.rb
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
# -*- encoding: binary -*-
|
2
|
+
require 'socket'
|
3
|
+
module Kgio
|
4
|
+
|
5
|
+
# The IPv4 address of UNIX domain sockets, useful for creating
|
6
|
+
# Rack (and CGI) servers that also serve HTTP traffic over
|
7
|
+
# UNIX domain sockets.
|
8
|
+
LOCALHOST = '127.0.0.1'
|
9
|
+
end
|
10
|
+
|
11
|
+
# Kgio::PipeMethods#kgio_tryread and Kgio::SocketMethods#kgio_tryread will
|
12
|
+
# return this constant when waiting for a read is required.
|
13
|
+
module Kgio::WaitReadable; end
|
14
|
+
|
15
|
+
# PipeMethods#kgio_trywrite and SocketMethods#kgio_trywrite will
|
16
|
+
# return this constant when waiting for a read is required.
|
17
|
+
module Kgio::WaitWritable; end
|
18
|
+
|
1
19
|
require 'kgio_ext'
|
2
20
|
|
3
21
|
# use Kgio::Pipe.popen and Kgio::Pipe.new instead of IO.popen
|
data/test/lib_read_write.rb
CHANGED
@@ -21,6 +21,16 @@ module LibReadWriteTest
|
|
21
21
|
assert_nil @rd.kgio_read(5)
|
22
22
|
end
|
23
23
|
|
24
|
+
def test_read_bang_eof
|
25
|
+
@wr.close
|
26
|
+
begin
|
27
|
+
@rd.kgio_read!(5)
|
28
|
+
assert false, "should never get here (line:#{__LINE__})"
|
29
|
+
rescue EOFError => e
|
30
|
+
assert_equal [], e.backtrace
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
24
34
|
def test_tryread_eof
|
25
35
|
@wr.close
|
26
36
|
assert_nil @rd.kgio_tryread(5)
|
@@ -28,16 +38,24 @@ module LibReadWriteTest
|
|
28
38
|
|
29
39
|
def test_write_closed
|
30
40
|
@rd.close
|
31
|
-
|
41
|
+
begin
|
32
42
|
loop { @wr.kgio_write "HI" }
|
33
|
-
|
43
|
+
rescue Errno::EPIPE, Errno::ECONNRESET => e
|
44
|
+
assert_equal [], e.backtrace
|
45
|
+
return
|
46
|
+
end
|
47
|
+
assert false, "should never get here (line:#{__LINE__})"
|
34
48
|
end
|
35
49
|
|
36
50
|
def test_trywrite_closed
|
37
51
|
@rd.close
|
38
|
-
|
52
|
+
begin
|
39
53
|
loop { @wr.kgio_trywrite "HI" }
|
40
|
-
|
54
|
+
rescue Errno::EPIPE, Errno::ECONNRESET => e
|
55
|
+
assert_equal [], e.backtrace
|
56
|
+
return
|
57
|
+
end
|
58
|
+
assert false, "should never get here (line:#{__LINE__})"
|
41
59
|
end
|
42
60
|
|
43
61
|
def test_write_conv
|
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: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 1.
|
10
|
+
version: 1.2.0
|
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: 2010-
|
18
|
+
date: 2010-10-05 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -55,13 +55,18 @@ files:
|
|
55
55
|
- README
|
56
56
|
- Rakefile
|
57
57
|
- TODO
|
58
|
+
- ext/kgio/accept.c
|
59
|
+
- ext/kgio/connect.c
|
58
60
|
- ext/kgio/extconf.rb
|
61
|
+
- ext/kgio/kgio.h
|
59
62
|
- ext/kgio/kgio_ext.c
|
60
63
|
- ext/kgio/missing/accept4.h
|
61
64
|
- ext/kgio/missing/ancient_ruby.h
|
62
65
|
- ext/kgio/my_fileno.h
|
63
66
|
- ext/kgio/nonblock.h
|
67
|
+
- ext/kgio/read_write.c
|
64
68
|
- ext/kgio/sock_for_fd.h
|
69
|
+
- ext/kgio/wait.c
|
65
70
|
- kgio.gemspec
|
66
71
|
- lib/kgio.rb
|
67
72
|
- setup.rb
|