libuv 1.0.3 → 1.1.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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/lib/libuv/async.rb +1 -1
- data/lib/libuv/check.rb +1 -1
- data/lib/libuv/dns.rb +1 -1
- data/lib/libuv/ext/ext.rb +15 -6
- data/lib/libuv/ext/platform/unix.rb +49 -0
- data/lib/libuv/ext/types.rb +53 -38
- data/lib/libuv/file.rb +10 -10
- data/lib/libuv/filesystem.rb +24 -14
- data/lib/libuv/fs_event.rb +1 -1
- data/lib/libuv/idle.rb +1 -1
- data/lib/libuv/mixins/fs_checks.rb +1 -1
- data/lib/libuv/mixins/stream.rb +2 -2
- data/lib/libuv/pipe.rb +5 -5
- data/lib/libuv/prepare.rb +1 -1
- data/lib/libuv/signal.rb +1 -1
- data/lib/libuv/tcp.rb +2 -2
- data/lib/libuv/timer.rb +1 -1
- data/lib/libuv/tty.rb +1 -1
- data/lib/libuv/udp.rb +2 -2
- data/lib/libuv/version.rb +1 -1
- data/lib/libuv/work.rb +1 -1
- data/spec/coroutines_spec.rb +106 -102
- metadata +8 -4
- data/lib/libuv/ext/platform/linux.rb +0 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ac0d4db86cce332900390f7f86ed875d8a192c7
|
4
|
+
data.tar.gz: 192887b8679a7f4faf3f646326b51a0aced660a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84ad189d9d92d8d0726bbd802458f05b72936eb0ade2825202624126a16e453fbad8040b61797f0e473cec7bddef3dfbf0fba64c3a6699dfcae75e04351f534a
|
7
|
+
data.tar.gz: 86500e813b9655a07499e3a06ceafd0dbfc797bcedbe8c5e07daf7263f883d4c5590353cb4ea1faee8e7479fc1e4bba9c67b36cfcb809f685f5b62dc6b4f12b2
|
data/.travis.yml
CHANGED
data/lib/libuv/async.rb
CHANGED
@@ -6,7 +6,7 @@ module Libuv
|
|
6
6
|
def initialize(loop, callback = nil, &blk)
|
7
7
|
@loop = loop
|
8
8
|
@callback = callback || blk
|
9
|
-
async_ptr = ::Libuv::Ext.
|
9
|
+
async_ptr = ::Libuv::Ext.allocate_handle_async
|
10
10
|
error = check_result(::Libuv::Ext.async_init(loop.handle, async_ptr, callback(:on_async)))
|
11
11
|
|
12
12
|
super(async_ptr, error)
|
data/lib/libuv/check.rb
CHANGED
@@ -8,7 +8,7 @@ module Libuv
|
|
8
8
|
@loop = loop
|
9
9
|
@callback = callback || blk
|
10
10
|
|
11
|
-
check_ptr = ::Libuv::Ext.
|
11
|
+
check_ptr = ::Libuv::Ext.allocate_handle_check
|
12
12
|
error = check_result(::Libuv::Ext.check_init(loop.handle, check_ptr))
|
13
13
|
|
14
14
|
super(check_ptr, error)
|
data/lib/libuv/dns.rb
CHANGED
@@ -35,7 +35,7 @@ module Libuv
|
|
35
35
|
@port = port
|
36
36
|
@hint = hint
|
37
37
|
@complete = false
|
38
|
-
@pointer = ::Libuv::Ext.
|
38
|
+
@pointer = ::Libuv::Ext.allocate_request_getaddrinfo
|
39
39
|
@error = nil # error in callback
|
40
40
|
|
41
41
|
error = check_result ::Libuv::Ext.getaddrinfo(@loop, @pointer, callback(:on_complete), domain, port.to_s, HINTS[hint])
|
data/lib/libuv/ext/ext.rb
CHANGED
@@ -48,7 +48,7 @@ module Libuv
|
|
48
48
|
|
49
49
|
# We need to calculate where the FS request data is located using req_size
|
50
50
|
class FsRequest < FFI::Struct
|
51
|
-
layout :req_data, [:uint8, Ext.req_size(:
|
51
|
+
layout :req_data, [:uint8, Ext.req_size(:req)],
|
52
52
|
:fs_type, :uv_fs_type,
|
53
53
|
:loop, :uv_loop_t,
|
54
54
|
:fs_callback, :pointer,
|
@@ -84,6 +84,11 @@ module Libuv
|
|
84
84
|
attach_function :walk, :uv_walk, [:uv_loop_t, :uv_walk_cb, :pointer], :void, :blocking => true
|
85
85
|
attach_function :close, :uv_close, [:uv_handle_t, :uv_close_cb], :void, :blocking => true
|
86
86
|
attach_function :is_closing, :uv_is_closing, [:uv_handle_t], :int, :blocking => true
|
87
|
+
# TODO:: Implement https://github.com/joyent/libuv/commit/0ecee213eac91beca141130cff2c7826242dab5a
|
88
|
+
# uv_recv_buffer_size
|
89
|
+
# uv_send_buffer_size
|
90
|
+
# https://github.com/joyent/libuv/commit/4ca9a363897cfa60f4e2229e4f15ac5abd7fd103
|
91
|
+
# uv_fileno
|
87
92
|
|
88
93
|
attach_function :buf_init, :uv_buf_init, [:pointer, :size_t], UvBuf.by_value, :blocking => true
|
89
94
|
|
@@ -159,7 +164,7 @@ module Libuv
|
|
159
164
|
attach_function :timer_again, :uv_timer_again, [:uv_timer_t], :int, :blocking => true
|
160
165
|
attach_function :timer_set_repeat, :uv_timer_set_repeat, [:uv_timer_t, :int64_t], :void, :blocking => true
|
161
166
|
attach_function :timer_get_repeat, :uv_timer_get_repeat, [:uv_timer_t], :int64_t, :blocking => true
|
162
|
-
#:addrinfo
|
167
|
+
#:addrinfo
|
163
168
|
attach_function :getaddrinfo, :uv_getaddrinfo, [:uv_loop_t, :uv_getaddrinfo_t, :uv_getaddrinfo_cb, :string, :string, UvAddrinfo.by_ref], :int, :blocking => true
|
164
169
|
attach_function :freeaddrinfo, :uv_freeaddrinfo, [UvAddrinfo.by_ref], :void, :blocking => true
|
165
170
|
|
@@ -189,6 +194,7 @@ module Libuv
|
|
189
194
|
attach_function :fs_mkdir, :uv_fs_mkdir, [:uv_loop_t, :uv_fs_t, :string, :int, :uv_fs_cb], :int, :blocking => true
|
190
195
|
attach_function :fs_rmdir, :uv_fs_rmdir, [:uv_loop_t, :uv_fs_t, :string, :uv_fs_cb], :int, :blocking => true
|
191
196
|
attach_function :fs_readdir, :uv_fs_readdir, [:uv_loop_t, :uv_fs_t, :string, :int, :uv_fs_cb], :int, :blocking => true
|
197
|
+
attach_function :fs_readdir_next, :uv_fs_readdir_next, [:uv_fs_t, :uv_dirent_t], :int, :blocking => true
|
192
198
|
attach_function :fs_stat, :uv_fs_stat, [:uv_loop_t, :uv_fs_t, :string, :uv_fs_cb], :int, :blocking => true
|
193
199
|
attach_function :fs_fstat, :uv_fs_fstat, [:uv_loop_t, :uv_fs_t, :uv_file, :uv_fs_cb], :int, :blocking => true
|
194
200
|
attach_function :fs_rename, :uv_fs_rename, [:uv_loop_t, :uv_fs_t, :string, :string, :uv_fs_cb], :int, :blocking => true
|
@@ -252,12 +258,15 @@ module Libuv
|
|
252
258
|
attach_function :thread_join, :uv_thread_join, [:uv_thread_t], :int, :blocking => true
|
253
259
|
|
254
260
|
|
255
|
-
|
256
|
-
|
261
|
+
# Predetermine the handle sizes
|
262
|
+
enum_type(:uv_handle_type).symbols.each do |handle_type|
|
263
|
+
handle_size = Ext.handle_size(handle_type)
|
264
|
+
define_singleton_method(:"allocate_handle_#{handle_type}") { LIBC.malloc(handle_size) }
|
257
265
|
end
|
258
266
|
|
259
|
-
|
260
|
-
|
267
|
+
enum_type(:uv_req_type).symbols.each do |request_type|
|
268
|
+
request_size = Ext.req_size(request_type)
|
269
|
+
define_singleton_method(:"allocate_request_#{request_type}") { LIBC.malloc(request_size) }
|
261
270
|
end
|
262
271
|
end
|
263
272
|
end
|
@@ -2,6 +2,39 @@ module Libuv
|
|
2
2
|
module Ext
|
3
3
|
typedef :int, :uv_os_sock_t
|
4
4
|
|
5
|
+
# blksize_t, in_addr_t is not yet part of types.conf on linux
|
6
|
+
typedef :long, :blksize_t
|
7
|
+
typedef :uint32, :in_addr_t
|
8
|
+
typedef :ushort, :in_port_t
|
9
|
+
|
10
|
+
class InAddr < FFI::Struct
|
11
|
+
layout :s_addr, :in_addr_t
|
12
|
+
end
|
13
|
+
|
14
|
+
class SockaddrIn < FFI::Struct
|
15
|
+
layout :sin_family, :sa_family_t,
|
16
|
+
:sin_port, :in_port_t,
|
17
|
+
:sin_addr, InAddr,
|
18
|
+
:sin_zero, [:char, 8]
|
19
|
+
end
|
20
|
+
|
21
|
+
class U6Addr < FFI::Union
|
22
|
+
layout :__u6_addr8, [:uint8, 16],
|
23
|
+
:__u6_addr16, [:uint16, 8]
|
24
|
+
end
|
25
|
+
|
26
|
+
class In6Addr < FFI::Struct
|
27
|
+
layout :__u6_addr, U6Addr
|
28
|
+
end
|
29
|
+
|
30
|
+
class SockaddrIn6 < FFI::Struct
|
31
|
+
layout :sin6_family, :sa_family_t,
|
32
|
+
:sin6_port, :in_port_t,
|
33
|
+
:sin6_flowinfo, :uint32,
|
34
|
+
:sin6_addr, In6Addr,
|
35
|
+
:sin6_scope_id, :uint32
|
36
|
+
end
|
37
|
+
|
5
38
|
class UvBuf < FFI::Struct
|
6
39
|
layout :base, :pointer, :len, :size_t
|
7
40
|
end
|
@@ -14,5 +47,21 @@ module Libuv
|
|
14
47
|
end
|
15
48
|
|
16
49
|
attach_function :ntohs, [:ushort], :ushort, :blocking => true
|
50
|
+
|
51
|
+
class Sockaddr < FFI::Struct
|
52
|
+
layout :sa_family, :sa_family_t,
|
53
|
+
:sa_data, [:char, 14]
|
54
|
+
end
|
55
|
+
|
56
|
+
class UvAddrinfo < FFI::Struct
|
57
|
+
layout :flags, :int,
|
58
|
+
:family, :int,
|
59
|
+
:socktype, :int,
|
60
|
+
:protocol, :int,
|
61
|
+
:addrlen, :socklen_t,
|
62
|
+
:addr, Sockaddr.by_ref,
|
63
|
+
:canonname, :string,
|
64
|
+
:next, UvAddrinfo.by_ref
|
65
|
+
end
|
17
66
|
end
|
18
67
|
end
|
data/lib/libuv/ext/types.rb
CHANGED
@@ -1,55 +1,53 @@
|
|
1
1
|
require 'socket' # Addrinfo
|
2
2
|
|
3
|
-
module FFI::Platform
|
4
|
-
def self.linux?
|
5
|
-
IS_LINUX
|
6
|
-
end
|
7
|
-
end
|
8
3
|
|
9
4
|
module Libuv
|
10
5
|
module Ext
|
11
|
-
#
|
12
|
-
class UvAddrinfo < FFI::Struct
|
6
|
+
# Needs to be defined so we can self reference
|
7
|
+
class UvAddrinfo < FFI::Struct
|
8
|
+
layout :flags, :int
|
9
|
+
end
|
13
10
|
|
14
|
-
|
11
|
+
# Defined in platform code
|
12
|
+
#require 'libuv/ext/platform/linux.rb' if FFI::Platform.linux?
|
15
13
|
require 'libuv/ext/platform/unix.rb' if FFI::Platform.unix?
|
16
14
|
require 'libuv/ext/platform/darwin_x64.rb' if FFI::Platform.mac? and FFI::Platform::ARCH == 'x86_64'
|
17
15
|
require 'libuv/ext/platform/windows.rb' if FFI::Platform.windows?
|
18
16
|
|
19
17
|
|
20
18
|
enum :uv_handle_type, [
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
19
|
+
:unknown_handle, 0,
|
20
|
+
:async, # start UV_HANDLE_TYPE_MAP
|
21
|
+
:check,
|
22
|
+
:fs_event,
|
23
|
+
:fs_poll,
|
24
|
+
:handle,
|
25
|
+
:idle,
|
26
|
+
:pipe,
|
27
|
+
:poll,
|
28
|
+
:prepare,
|
29
|
+
:process,
|
30
|
+
:stream,
|
31
|
+
:tcp,
|
32
|
+
:timer,
|
33
|
+
:tty,
|
34
|
+
:udp,
|
35
|
+
:signal, # end UV_HANDLE_TYPE_MAP
|
36
|
+
:file,
|
37
|
+
:handle_type_max
|
40
38
|
]
|
41
39
|
enum :uv_req_type, [
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
40
|
+
:unknown_req, 0,
|
41
|
+
:req, # start UV_REQ_TYPE_MAP
|
42
|
+
:connect,
|
43
|
+
:write,
|
44
|
+
:shutdown,
|
45
|
+
:udp_send,
|
46
|
+
:fs,
|
47
|
+
:work,
|
48
|
+
:getaddrinfo, # end UV_REQ_TYPE_MAP
|
49
|
+
:req_type_private,
|
50
|
+
:req_type_max
|
53
51
|
]
|
54
52
|
enum :uv_membership, [
|
55
53
|
:uv_leave_group, 0,
|
@@ -93,6 +91,23 @@ module Libuv
|
|
93
91
|
:UV_RUN_ONCE,
|
94
92
|
:UV_RUN_NOWAIT
|
95
93
|
]
|
94
|
+
enum :uv_dirent_type, [
|
95
|
+
:UV_DIRENT_UNKNOWN, 0,
|
96
|
+
:UV_DIRENT_FILE,
|
97
|
+
:UV_DIRENT_DIR,
|
98
|
+
:UV_DIRENT_LINK,
|
99
|
+
:UV_DIRENT_FIFO,
|
100
|
+
:UV_DIRENT_SOCKET,
|
101
|
+
:UV_DIRENT_CHAR,
|
102
|
+
:UV_DIRENT_BLOCK
|
103
|
+
]
|
104
|
+
|
105
|
+
class UvDirent < FFI::Struct
|
106
|
+
layout :name, :string,
|
107
|
+
:type, :uv_dirent_type
|
108
|
+
end
|
109
|
+
typedef UvDirent.by_ref, :uv_dirent_t
|
110
|
+
|
96
111
|
|
97
112
|
typedef UvBuf.by_ref, :uv_buf_t
|
98
113
|
typedef SockaddrIn.by_ref, :sockaddr_in4
|
data/lib/libuv/file.rb
CHANGED
@@ -18,14 +18,14 @@ module Libuv
|
|
18
18
|
@path, @flags, @mode = path, flags, mode
|
19
19
|
@request_refs = {}
|
20
20
|
|
21
|
-
request = ::Libuv::Ext.
|
21
|
+
request = ::Libuv::Ext.allocate_request_fs
|
22
22
|
pre_check @defer, request, ::Libuv::Ext.fs_open(@loop, request, @path, @flags, @mode, callback(:on_open))
|
23
23
|
nil
|
24
24
|
end
|
25
25
|
|
26
26
|
def close
|
27
27
|
@closed = true
|
28
|
-
request = ::Libuv::Ext.
|
28
|
+
request = ::Libuv::Ext.allocate_request_fs
|
29
29
|
pre_check(@defer, request, ::Libuv::Ext.fs_close(@loop.handle, request, @fileno, callback(:on_close)))
|
30
30
|
nil # pre-check returns a promise
|
31
31
|
end
|
@@ -37,7 +37,7 @@ module Libuv
|
|
37
37
|
|
38
38
|
buffer1 = FFI::MemoryPointer.new(length)
|
39
39
|
buffer = ::Libuv::Ext.buf_init(buffer1, length)
|
40
|
-
request = ::Libuv::Ext.
|
40
|
+
request = ::Libuv::Ext.allocate_request_fs
|
41
41
|
|
42
42
|
@request_refs[request.address] = [deferred, buffer1]
|
43
43
|
|
@@ -53,7 +53,7 @@ module Libuv
|
|
53
53
|
|
54
54
|
buffer1 = FFI::MemoryPointer.from_string(data)
|
55
55
|
buffer = ::Libuv::Ext.buf_init(buffer1, length)
|
56
|
-
request = ::Libuv::Ext.
|
56
|
+
request = ::Libuv::Ext.allocate_request_fs
|
57
57
|
|
58
58
|
@request_refs[request.address] = [deferred, buffer1]
|
59
59
|
|
@@ -63,7 +63,7 @@ module Libuv
|
|
63
63
|
def sync
|
64
64
|
deferred = @loop.defer
|
65
65
|
|
66
|
-
request = ::Libuv::Ext.
|
66
|
+
request = ::Libuv::Ext.allocate_request_fs
|
67
67
|
@request_refs[request.address] = deferred
|
68
68
|
|
69
69
|
pre_check deferred, request, ::Libuv::Ext.fs_fsync(@loop.handle, request, @fileno, callback(:on_sync))
|
@@ -72,7 +72,7 @@ module Libuv
|
|
72
72
|
def datasync
|
73
73
|
deferred = @loop.defer
|
74
74
|
|
75
|
-
request = ::Libuv::Ext.
|
75
|
+
request = ::Libuv::Ext.allocate_request_fs
|
76
76
|
@request_refs[request.address] = deferred
|
77
77
|
|
78
78
|
pre_check deferred, request, ::Libuv::Ext.fs_fdatasync(@loop.handle, request, @fileno, callback(:on_datasync))
|
@@ -82,7 +82,7 @@ module Libuv
|
|
82
82
|
assert_type(Integer, offset, "offset must be an Integer")
|
83
83
|
deferred = @loop.defer
|
84
84
|
|
85
|
-
request = ::Libuv::Ext.
|
85
|
+
request = ::Libuv::Ext.allocate_request_fs
|
86
86
|
@request_refs[request.address] = deferred
|
87
87
|
|
88
88
|
pre_check deferred, request, ::Libuv::Ext.fs_ftruncate(@loop.handle, request, @fileno, offset, callback(:on_truncate))
|
@@ -93,7 +93,7 @@ module Libuv
|
|
93
93
|
assert_type(Integer, mtime, "mtime must be an Integer")
|
94
94
|
deferred = @loop.defer
|
95
95
|
|
96
|
-
request = ::Libuv::Ext.
|
96
|
+
request = ::Libuv::Ext.allocate_request_fs
|
97
97
|
@request_refs[request.address] = deferred
|
98
98
|
|
99
99
|
pre_check deferred, request, ::Libuv::Ext.fs_futime(@loop.handle, request, @fileno, atime, mtime, callback(:on_utime))
|
@@ -103,7 +103,7 @@ module Libuv
|
|
103
103
|
assert_type(Integer, mode, "mode must be an Integer")
|
104
104
|
deferred = @loop.defer
|
105
105
|
|
106
|
-
request = ::Libuv::Ext.
|
106
|
+
request = ::Libuv::Ext.allocate_request_fs
|
107
107
|
@request_refs[request.address] = deferred
|
108
108
|
|
109
109
|
pre_check deferred, request, ::Libuv::Ext.fs_fchmod(@loop.handle, request, @fileno, mode, callback(:on_chmod))
|
@@ -114,7 +114,7 @@ module Libuv
|
|
114
114
|
assert_type(Integer, gid, "gid must be an Integer")
|
115
115
|
deferred = @loop.defer
|
116
116
|
|
117
|
-
request = ::Libuv::Ext.
|
117
|
+
request = ::Libuv::Ext.allocate_request_fs
|
118
118
|
@request_refs[request.address] = deferred
|
119
119
|
|
120
120
|
pre_check deferred, request, ::Libuv::Ext.fs_fchown(@loop.handle, request, @fileno, uid, gid, callback(:on_chown))
|
data/lib/libuv/filesystem.rb
CHANGED
@@ -11,7 +11,7 @@ module Libuv
|
|
11
11
|
assert_type(String, path, "path must be a String")
|
12
12
|
@unlink_deferred = @loop.defer
|
13
13
|
|
14
|
-
request = ::Libuv::Ext.
|
14
|
+
request = ::Libuv::Ext.allocate_request_fs
|
15
15
|
pre_check @unlink_deferred, request, ::Libuv::Ext.fs_unlink(@loop, request, path, callback(:on_unlink))
|
16
16
|
@unlink_deferred.promise
|
17
17
|
end
|
@@ -21,7 +21,7 @@ module Libuv
|
|
21
21
|
assert_type(Integer, mode, "mode must be an Integer")
|
22
22
|
@mkdir_deferred = @loop.defer
|
23
23
|
|
24
|
-
request = ::Libuv::Ext.
|
24
|
+
request = ::Libuv::Ext.allocate_request_fs
|
25
25
|
pre_check @mkdir_deferred, request, ::Libuv::Ext.fs_mkdir(@loop, request, path, mode, callback(:on_mkdir))
|
26
26
|
@mkdir_deferred.promise
|
27
27
|
end
|
@@ -30,7 +30,7 @@ module Libuv
|
|
30
30
|
assert_type(String, path, "path must be a String")
|
31
31
|
@rmdir_deferred = @loop.defer
|
32
32
|
|
33
|
-
request = ::Libuv::Ext.
|
33
|
+
request = ::Libuv::Ext.allocate_request_fs
|
34
34
|
pre_check @rmdir_deferred, request, ::Libuv::Ext.fs_rmdir(@loop, request, path, callback(:on_rmdir))
|
35
35
|
@rmdir_deferred.promise
|
36
36
|
end
|
@@ -39,7 +39,7 @@ module Libuv
|
|
39
39
|
assert_type(String, path, "path must be a String")
|
40
40
|
@readdir_deferred = @loop.defer
|
41
41
|
|
42
|
-
request = ::Libuv::Ext.
|
42
|
+
request = ::Libuv::Ext.allocate_request_fs
|
43
43
|
pre_check @readdir_deferred, request, ::Libuv::Ext.fs_readdir(@loop, request, path, 0, callback(:on_readdir))
|
44
44
|
@readdir_deferred.promise
|
45
45
|
end
|
@@ -49,7 +49,7 @@ module Libuv
|
|
49
49
|
assert_type(String, new_path, "new_path must be a String")
|
50
50
|
@rename_deferred = @loop.defer
|
51
51
|
|
52
|
-
request = ::Libuv::Ext.
|
52
|
+
request = ::Libuv::Ext.allocate_request_fs
|
53
53
|
pre_check @rename_deferred, request, ::Libuv::Ext.fs_rename(@loop, request, old_path, new_path, callback(:on_rename))
|
54
54
|
@rename_deferred.promise
|
55
55
|
end
|
@@ -59,7 +59,7 @@ module Libuv
|
|
59
59
|
assert_type(Integer, mode, "mode must be an Integer")
|
60
60
|
@chmod_deferred = @loop.defer
|
61
61
|
|
62
|
-
request = ::Libuv::Ext.
|
62
|
+
request = ::Libuv::Ext.allocate_request_fs
|
63
63
|
pre_check @chmod_deferred, request, ::Libuv::Ext.fs_chmod(@loop, request, path, mode, callback(:on_chmod))
|
64
64
|
@chmod_deferred.promise
|
65
65
|
end
|
@@ -70,7 +70,7 @@ module Libuv
|
|
70
70
|
assert_type(Integer, mtime, "mtime must be an Integer")
|
71
71
|
@utime_deferred = @loop.defer
|
72
72
|
|
73
|
-
request = ::Libuv::Ext.
|
73
|
+
request = ::Libuv::Ext.allocate_request_fs
|
74
74
|
pre_check @utime_deferred, request, ::Libuv::Ext.fs_utime(@loop, request, path, atime, mtime, callback(:on_utime))
|
75
75
|
@utime_deferred.promise
|
76
76
|
end
|
@@ -79,7 +79,7 @@ module Libuv
|
|
79
79
|
assert_type(String, path, "path must be a String")
|
80
80
|
@stat_deferred = @loop.defer
|
81
81
|
|
82
|
-
request = ::Libuv::Ext.
|
82
|
+
request = ::Libuv::Ext.allocate_request_fs
|
83
83
|
pre_check @stat_deferred, request, ::Libuv::Ext.fs_lstat(@loop, request, path, callback(:on_stat))
|
84
84
|
@stat_deferred.promise
|
85
85
|
end
|
@@ -89,7 +89,7 @@ module Libuv
|
|
89
89
|
assert_type(String, new_path, "new_path must be a String")
|
90
90
|
@link_deferred = @loop.defer
|
91
91
|
|
92
|
-
request = ::Libuv::Ext.
|
92
|
+
request = ::Libuv::Ext.allocate_request_fs
|
93
93
|
pre_check @link_deferred, request, ::Libuv::Ext.fs_link(@loop, request, old_path, new_path, callback(:on_link))
|
94
94
|
@link_deferred.promise
|
95
95
|
end
|
@@ -99,7 +99,7 @@ module Libuv
|
|
99
99
|
assert_type(String, new_path, "new_path must be a String")
|
100
100
|
@symlink_deferred = @loop.defer
|
101
101
|
|
102
|
-
request = ::Libuv::Ext.
|
102
|
+
request = ::Libuv::Ext.allocate_request_fs
|
103
103
|
pre_check @symlink_deferred, request, ::Libuv::Ext.fs_symlink(@loop, request, old_path, new_path, 0, callback(:on_symlink))
|
104
104
|
@symlink_deferred.promise
|
105
105
|
end
|
@@ -108,7 +108,7 @@ module Libuv
|
|
108
108
|
assert_type(String, path, "path must be a String")
|
109
109
|
@readlink_deferred = @loop.defer
|
110
110
|
|
111
|
-
request = ::Libuv::Ext.
|
111
|
+
request = ::Libuv::Ext.allocate_request_fs
|
112
112
|
pre_check @readlink_deferred, request, ::Libuv::Ext.fs_readlink(@loop, request, path, callback(:on_readlink))
|
113
113
|
@readlink_deferred.promise
|
114
114
|
end
|
@@ -119,7 +119,7 @@ module Libuv
|
|
119
119
|
assert_type(Integer, gid, "gid must be an Integer")
|
120
120
|
@chown_deferred = @loop.defer
|
121
121
|
|
122
|
-
request = ::Libuv::Ext.
|
122
|
+
request = ::Libuv::Ext.allocate_request_fs
|
123
123
|
pre_check @chown_deferred, request, ::Libuv::Ext.fs_chown(@loop, request, path, uid, gid, callback(:on_chown))
|
124
124
|
@chown_deferred.promise
|
125
125
|
end
|
@@ -158,8 +158,18 @@ module Libuv
|
|
158
158
|
def on_readdir(req)
|
159
159
|
if post_check(req, @readdir_deferred)
|
160
160
|
num_files = req[:result]
|
161
|
-
|
162
|
-
|
161
|
+
|
162
|
+
info = ::Libuv::Ext::UvDirent.new
|
163
|
+
files = []
|
164
|
+
ret = 1
|
165
|
+
loop do
|
166
|
+
ret = ::Libuv::Ext.fs_readdir_next(req, info)
|
167
|
+
files << [info[:name], info[:type]]
|
168
|
+
|
169
|
+
# EOF is the alternative
|
170
|
+
break unless ret == 0
|
171
|
+
end
|
172
|
+
|
163
173
|
cleanup(req)
|
164
174
|
@readdir_deferred.resolve(files)
|
165
175
|
end
|
data/lib/libuv/fs_event.rb
CHANGED
@@ -8,7 +8,7 @@ module Libuv
|
|
8
8
|
def initialize(loop, path)
|
9
9
|
@loop = loop
|
10
10
|
|
11
|
-
fs_event_ptr = ::Libuv::Ext.
|
11
|
+
fs_event_ptr = ::Libuv::Ext.allocate_handle_fs_event
|
12
12
|
error = check_result ::Libuv::Ext.fs_event_init(loop.handle, fs_event_ptr, path, callback(:on_fs_event), 0)
|
13
13
|
|
14
14
|
super(fs_event_ptr, error)
|
data/lib/libuv/idle.rb
CHANGED
@@ -6,7 +6,7 @@ module Libuv
|
|
6
6
|
def stat
|
7
7
|
@stat_deferred = @loop.defer
|
8
8
|
|
9
|
-
request = ::Libuv::Ext.
|
9
|
+
request = ::Libuv::Ext.allocate_request_fs
|
10
10
|
pre_check @stat_deferred, request, ::Libuv::Ext.fs_fstat(@loop.handle, request, @fileno, callback(:on_stat))
|
11
11
|
@stat_deferred.promise
|
12
12
|
end
|
data/lib/libuv/mixins/stream.rb
CHANGED
@@ -32,7 +32,7 @@ module Libuv
|
|
32
32
|
# Shutsdown the writes on the handle waiting until the last write is complete before triggering the callback
|
33
33
|
def shutdown
|
34
34
|
return if @closed
|
35
|
-
error = check_result ::Libuv::Ext.shutdown(::Libuv::Ext.
|
35
|
+
error = check_result ::Libuv::Ext.shutdown(::Libuv::Ext.allocate_request_shutdown, handle, callback(:on_shutdown))
|
36
36
|
reject(error) if error
|
37
37
|
end
|
38
38
|
|
@@ -62,7 +62,7 @@ module Libuv
|
|
62
62
|
|
63
63
|
# local as this variable will be available until the handle is closed
|
64
64
|
@write_callbacks ||= {}
|
65
|
-
req = ::Libuv::Ext.
|
65
|
+
req = ::Libuv::Ext.allocate_request_write
|
66
66
|
@write_callbacks[req.address] = [deferred, buffer1]
|
67
67
|
error = check_result ::Libuv::Ext.write(req, handle, buffer, 1, callback(:write_complete))
|
68
68
|
|
data/lib/libuv/pipe.rb
CHANGED
@@ -9,7 +9,7 @@ module Libuv
|
|
9
9
|
def initialize(loop, ipc, acceptor = nil)
|
10
10
|
@loop, @ipc = loop, ipc
|
11
11
|
|
12
|
-
pipe_ptr = ::Libuv::Ext.
|
12
|
+
pipe_ptr = ::Libuv::Ext.allocate_handle_pipe
|
13
13
|
error = check_result(::Libuv::Ext.pipe_init(loop.handle, pipe_ptr, ipc ? 1 : 0))
|
14
14
|
error = check_result(::Libuv::Ext.accept(acceptor, pipe_ptr)) if acceptor && error.nil?
|
15
15
|
|
@@ -68,7 +68,7 @@ module Libuv
|
|
68
68
|
assert_type(String, name, "name must be a String")
|
69
69
|
begin
|
70
70
|
name = windows_path name if FFI::Platform.windows?
|
71
|
-
::Libuv::Ext.pipe_connect(::Libuv::Ext.
|
71
|
+
::Libuv::Ext.pipe_connect(::Libuv::Ext.allocate_request_connect, handle, name, callback(:on_connect))
|
72
72
|
rescue Exception => e
|
73
73
|
reject(e)
|
74
74
|
end
|
@@ -100,7 +100,7 @@ module Libuv
|
|
100
100
|
|
101
101
|
|
102
102
|
@write_callbacks << [deferred, callback]
|
103
|
-
req = ::Libuv::Ext.
|
103
|
+
req = ::Libuv::Ext.allocate_request_write
|
104
104
|
error = check_result ::Libuv::Ext.write2(req, handle, buffer, 1, fd.handle, callback)
|
105
105
|
|
106
106
|
if error
|
@@ -135,9 +135,9 @@ module Libuv
|
|
135
135
|
# Hide the accept logic
|
136
136
|
remote = nil
|
137
137
|
case pending
|
138
|
-
when :
|
138
|
+
when :tcp
|
139
139
|
remote = TCP.new(loop, handle)
|
140
|
-
when :
|
140
|
+
when :pipe
|
141
141
|
remote = Pipe.new(loop, @ipc, handle)
|
142
142
|
else
|
143
143
|
raise NotImplementedError, "IPC for handle #{pending} not supported"
|
data/lib/libuv/prepare.rb
CHANGED
@@ -8,7 +8,7 @@ module Libuv
|
|
8
8
|
@loop = loop
|
9
9
|
@callback = callback || blk
|
10
10
|
|
11
|
-
prepare_ptr = ::Libuv::Ext.
|
11
|
+
prepare_ptr = ::Libuv::Ext.allocate_handle_prepare
|
12
12
|
error = check_result(::Libuv::Ext.prepare_init(loop.handle, prepare_ptr))
|
13
13
|
|
14
14
|
super(prepare_ptr, error)
|
data/lib/libuv/signal.rb
CHANGED
@@ -19,7 +19,7 @@ module Libuv
|
|
19
19
|
def initialize(loop)
|
20
20
|
@loop = loop
|
21
21
|
|
22
|
-
signal_ptr = ::Libuv::Ext.
|
22
|
+
signal_ptr = ::Libuv::Ext.allocate_handle_signal
|
23
23
|
error = check_result(::Libuv::Ext.signal_init(loop.handle, signal_ptr))
|
24
24
|
|
25
25
|
super(signal_ptr, error)
|
data/lib/libuv/tcp.rb
CHANGED
@@ -18,7 +18,7 @@ module Libuv
|
|
18
18
|
def initialize(loop, acceptor = nil)
|
19
19
|
@loop = loop
|
20
20
|
|
21
|
-
tcp_ptr = ::Libuv::Ext.
|
21
|
+
tcp_ptr = ::Libuv::Ext.allocate_handle_tcp
|
22
22
|
error = check_result(::Libuv::Ext.tcp_init(loop.handle, tcp_ptr))
|
23
23
|
|
24
24
|
if acceptor && error.nil?
|
@@ -291,7 +291,7 @@ module Libuv
|
|
291
291
|
|
292
292
|
|
293
293
|
def connect_req
|
294
|
-
::Libuv::Ext.
|
294
|
+
::Libuv::Ext.allocate_request_connect
|
295
295
|
end
|
296
296
|
|
297
297
|
def tcp_connect(callback)
|
data/lib/libuv/timer.rb
CHANGED
@@ -6,7 +6,7 @@ module Libuv
|
|
6
6
|
def initialize(loop, callback = nil)
|
7
7
|
@loop, @callback = loop, callback
|
8
8
|
|
9
|
-
timer_ptr = ::Libuv::Ext.
|
9
|
+
timer_ptr = ::Libuv::Ext.allocate_handle_timer
|
10
10
|
error = check_result(::Libuv::Ext.timer_init(loop.handle, timer_ptr))
|
11
11
|
@stopped = true
|
12
12
|
|
data/lib/libuv/tty.rb
CHANGED
@@ -6,7 +6,7 @@ module Libuv
|
|
6
6
|
def initialize(loop, fileno, readable)
|
7
7
|
@loop = loop
|
8
8
|
|
9
|
-
tty_ptr = ::Libuv::Ext.
|
9
|
+
tty_ptr = ::Libuv::Ext.allocate_handle_tty
|
10
10
|
error = check_result(::Libuv::Ext.tty_init(loop.handle, tty_ptr, fileno, readable ? 1 : 0))
|
11
11
|
|
12
12
|
super(tty_ptr, error)
|
data/lib/libuv/udp.rb
CHANGED
@@ -13,7 +13,7 @@ module Libuv
|
|
13
13
|
def initialize(loop)
|
14
14
|
@loop = loop
|
15
15
|
|
16
|
-
udp_ptr = ::Libuv::Ext.
|
16
|
+
udp_ptr = ::Libuv::Ext.allocate_handle_udp
|
17
17
|
error = check_result(::Libuv::Ext.udp_init(loop.handle, udp_ptr))
|
18
18
|
@request_refs = {}
|
19
19
|
|
@@ -189,7 +189,7 @@ module Libuv
|
|
189
189
|
|
190
190
|
|
191
191
|
def send_req
|
192
|
-
::Libuv::Ext.
|
192
|
+
::Libuv::Ext.allocate_request_udp_send
|
193
193
|
end
|
194
194
|
|
195
195
|
def create_sockaddr(ip, port)
|
data/lib/libuv/version.rb
CHANGED
data/lib/libuv/work.rb
CHANGED
@@ -14,7 +14,7 @@ module Libuv
|
|
14
14
|
|
15
15
|
@work = work
|
16
16
|
@complete = false
|
17
|
-
@pointer = ::Libuv::Ext.
|
17
|
+
@pointer = ::Libuv::Ext.allocate_request_work
|
18
18
|
@error = nil # error in callback
|
19
19
|
|
20
20
|
error = check_result ::Libuv::Ext.queue_work(@loop, @pointer, callback(:on_work), callback(:on_complete))
|
data/spec/coroutines_spec.rb
CHANGED
@@ -1,136 +1,140 @@
|
|
1
1
|
require 'libuv'
|
2
|
-
require 'libuv/coroutines' # adds support for coroutines
|
3
2
|
|
3
|
+
# No support for Fibers in jRuby
|
4
|
+
if RUBY_PLATFORM != 'java'
|
5
|
+
require 'libuv/coroutines' # adds support for coroutines
|
4
6
|
|
5
|
-
describe Object do
|
6
|
-
before :each do
|
7
|
-
@log = []
|
8
|
-
@general_failure = []
|
9
7
|
|
10
|
-
|
11
|
-
|
12
|
-
@
|
13
|
-
@
|
14
|
-
@general_failure << "test timed out"
|
15
|
-
end
|
16
|
-
@timeout.start(5000)
|
17
|
-
end
|
18
|
-
|
19
|
-
describe 'serial execution' do
|
20
|
-
it "should wait for work to complete and return the result" do
|
21
|
-
@loop.run { |logger|
|
22
|
-
logger.progress do |level, errorid, error|
|
23
|
-
begin
|
24
|
-
@general_failure << "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n") if error.backtrace}\n"
|
25
|
-
rescue Exception => e
|
26
|
-
@general_failure << "error in logger #{e.inspect}"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
@log << co(@loop.work(proc {
|
32
|
-
sleep 1
|
33
|
-
'work done'
|
34
|
-
}))
|
35
|
-
@log << 'after work'
|
8
|
+
describe Object do
|
9
|
+
before :each do
|
10
|
+
@log = []
|
11
|
+
@general_failure = []
|
36
12
|
|
13
|
+
@loop = Libuv::Loop.default
|
14
|
+
@timeout = @loop.timer do
|
37
15
|
@timeout.close
|
38
16
|
@loop.stop
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
expect(@log).to eq(['work done', 'after work'])
|
17
|
+
@general_failure << "test timed out"
|
18
|
+
end
|
19
|
+
@timeout.start(5000)
|
43
20
|
end
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
21
|
+
|
22
|
+
describe 'serial execution' do
|
23
|
+
it "should wait for work to complete and return the result" do
|
24
|
+
@loop.run { |logger|
|
25
|
+
logger.progress do |level, errorid, error|
|
26
|
+
begin
|
27
|
+
@general_failure << "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n") if error.backtrace}\n"
|
28
|
+
rescue Exception => e
|
29
|
+
@general_failure << "error in logger #{e.inspect}"
|
30
|
+
end
|
52
31
|
end
|
53
|
-
end
|
54
32
|
|
55
|
-
|
33
|
+
|
56
34
|
@log << co(@loop.work(proc {
|
57
|
-
|
35
|
+
sleep 1
|
36
|
+
'work done'
|
58
37
|
}))
|
59
38
|
@log << 'after work'
|
60
|
-
rescue => e
|
61
|
-
@log << e.message
|
62
|
-
end
|
63
|
-
|
64
|
-
@timeout.close
|
65
|
-
@loop.stop
|
66
|
-
}
|
67
39
|
|
68
|
-
|
69
|
-
|
70
|
-
|
40
|
+
@timeout.close
|
41
|
+
@loop.stop
|
42
|
+
}
|
43
|
+
|
44
|
+
expect(@general_failure).to eq([])
|
45
|
+
expect(@log).to eq(['work done', 'after work'])
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should raise an error if the promise is rejected" do
|
49
|
+
@loop.run { |logger|
|
50
|
+
logger.progress do |level, errorid, error|
|
51
|
+
begin
|
52
|
+
@general_failure << "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n") if error.backtrace}\n"
|
53
|
+
rescue Exception => e
|
54
|
+
@general_failure << "error in logger #{e.inspect}"
|
55
|
+
end
|
56
|
+
end
|
71
57
|
|
72
|
-
it "should return the results of multiple promises" do
|
73
|
-
@loop.run { |logger|
|
74
|
-
logger.progress do |level, errorid, error|
|
75
58
|
begin
|
76
|
-
@
|
77
|
-
|
78
|
-
|
59
|
+
@log << co(@loop.work(proc {
|
60
|
+
raise 'rejected'
|
61
|
+
}))
|
62
|
+
@log << 'after work'
|
63
|
+
rescue => e
|
64
|
+
@log << e.message
|
79
65
|
end
|
80
|
-
end
|
81
66
|
|
67
|
+
@timeout.close
|
68
|
+
@loop.stop
|
69
|
+
}
|
70
|
+
|
71
|
+
expect(@general_failure).to eq([])
|
72
|
+
expect(@log).to eq(['rejected'])
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should return the results of multiple promises" do
|
76
|
+
@loop.run { |logger|
|
77
|
+
logger.progress do |level, errorid, error|
|
78
|
+
begin
|
79
|
+
@general_failure << "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n") if error.backtrace}\n"
|
80
|
+
rescue Exception => e
|
81
|
+
@general_failure << "error in logger #{e.inspect}"
|
82
|
+
end
|
83
|
+
end
|
82
84
|
|
83
|
-
job1 = @loop.work(proc {
|
84
|
-
sleep 1
|
85
|
-
'job1'
|
86
|
-
})
|
87
85
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
86
|
+
job1 = @loop.work(proc {
|
87
|
+
sleep 1
|
88
|
+
'job1'
|
89
|
+
})
|
92
90
|
|
93
|
-
|
94
|
-
|
91
|
+
job2 = @loop.work(proc {
|
92
|
+
sleep 1
|
93
|
+
'job2'
|
94
|
+
})
|
95
95
|
|
96
|
-
|
97
|
-
|
98
|
-
@log << 'after work'
|
96
|
+
# Job1 and Job2 are executed in parallel
|
97
|
+
result1, result2 = co(job1, job2)
|
99
98
|
|
100
|
-
|
101
|
-
|
102
|
-
|
99
|
+
@log << result1
|
100
|
+
@log << result2
|
101
|
+
@log << 'after work'
|
103
102
|
|
104
|
-
|
105
|
-
|
106
|
-
|
103
|
+
@timeout.close
|
104
|
+
@loop.stop
|
105
|
+
}
|
107
106
|
|
107
|
+
expect(@general_failure).to eq([])
|
108
|
+
expect(@log).to eq(['job1', 'job2', 'after work'])
|
109
|
+
end
|
108
110
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
111
|
+
|
112
|
+
it "should provide a callback option for progress events" do
|
113
|
+
@loop.run { |logger|
|
114
|
+
logger.progress do |level, errorid, error|
|
115
|
+
begin
|
116
|
+
@general_failure << "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n") if error.backtrace}\n"
|
117
|
+
rescue Exception => e
|
118
|
+
@general_failure << "error in logger #{e.inspect}"
|
119
|
+
end
|
116
120
|
end
|
117
|
-
end
|
118
121
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
122
|
+
timer = @loop.timer
|
123
|
+
timer.start(0)
|
124
|
+
co(timer) do
|
125
|
+
@log << 'in timer'
|
126
|
+
timer.close # close will resolve the promise
|
127
|
+
end
|
125
128
|
|
126
|
-
|
129
|
+
@log << 'after timer'
|
127
130
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
+
@timeout.close
|
132
|
+
@loop.stop
|
133
|
+
}
|
131
134
|
|
132
|
-
|
133
|
-
|
135
|
+
expect(@log).to eq(['in timer', 'after timer'])
|
136
|
+
expect(@general_failure).to eq([])
|
137
|
+
end
|
134
138
|
end
|
135
139
|
end
|
136
140
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libuv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bulat Shakirzyanov
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-09-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
@@ -122,7 +122,6 @@ files:
|
|
122
122
|
- lib/libuv/error.rb
|
123
123
|
- lib/libuv/ext/ext.rb
|
124
124
|
- lib/libuv/ext/platform/darwin_x64.rb
|
125
|
-
- lib/libuv/ext/platform/linux.rb
|
126
125
|
- lib/libuv/ext/platform/unix.rb
|
127
126
|
- lib/libuv/ext/platform/windows.rb
|
128
127
|
- lib/libuv/ext/tasks.rb
|
@@ -346,6 +345,7 @@ files:
|
|
346
345
|
- ext/libuv/test/test-getaddrinfo.c
|
347
346
|
- ext/libuv/test/test-getnameinfo.c
|
348
347
|
- ext/libuv/test/test-getsockname.c
|
348
|
+
- ext/libuv/test/test-handle-fileno.c
|
349
349
|
- ext/libuv/test/test-hrtime.c
|
350
350
|
- ext/libuv/test/test-idle.c
|
351
351
|
- ext/libuv/test/test-ip4-addr.c
|
@@ -364,6 +364,7 @@ files:
|
|
364
364
|
- ext/libuv/test/test-pass-always.c
|
365
365
|
- ext/libuv/test/test-ping-pong.c
|
366
366
|
- ext/libuv/test/test-pipe-bind-error.c
|
367
|
+
- ext/libuv/test/test-pipe-close-stdout-read-stdin.c
|
367
368
|
- ext/libuv/test/test-pipe-connect-error.c
|
368
369
|
- ext/libuv/test/test-pipe-getsockname.c
|
369
370
|
- ext/libuv/test/test-pipe-sendmsg.c
|
@@ -382,6 +383,7 @@ files:
|
|
382
383
|
- ext/libuv/test/test-shutdown-twice.c
|
383
384
|
- ext/libuv/test/test-signal-multiple-loops.c
|
384
385
|
- ext/libuv/test/test-signal.c
|
386
|
+
- ext/libuv/test/test-socket-buffer-size.c
|
385
387
|
- ext/libuv/test/test-spawn.c
|
386
388
|
- ext/libuv/test/test-stdio-over-pipes.c
|
387
389
|
- ext/libuv/test/test-tcp-bind-error.c
|
@@ -399,6 +401,7 @@ files:
|
|
399
401
|
- ext/libuv/test/test-tcp-shutdown-after-write.c
|
400
402
|
- ext/libuv/test/test-tcp-try-write.c
|
401
403
|
- ext/libuv/test/test-tcp-unexpected-read.c
|
404
|
+
- ext/libuv/test/test-tcp-write-after-connect.c
|
402
405
|
- ext/libuv/test/test-tcp-write-queue-order.c
|
403
406
|
- ext/libuv/test/test-tcp-write-to-half-open-connection.c
|
404
407
|
- ext/libuv/test/test-tcp-writealot.c
|
@@ -421,6 +424,7 @@ files:
|
|
421
424
|
- ext/libuv/test/test-udp-options.c
|
422
425
|
- ext/libuv/test/test-udp-send-and-recv.c
|
423
426
|
- ext/libuv/test/test-udp-send-immediate.c
|
427
|
+
- ext/libuv/test/test-udp-send-unreachable.c
|
424
428
|
- ext/libuv/test/test-udp-try-send.c
|
425
429
|
- ext/libuv/test/test-walk-handles.c
|
426
430
|
- ext/libuv/test/test-watcher-cross-stop.c
|
@@ -446,7 +450,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
446
450
|
version: '0'
|
447
451
|
requirements: []
|
448
452
|
rubyforge_project:
|
449
|
-
rubygems_version: 2.
|
453
|
+
rubygems_version: 2.0.14
|
450
454
|
signing_key:
|
451
455
|
specification_version: 4
|
452
456
|
summary: libuv bindings for Ruby
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module Libuv
|
2
|
-
module Ext
|
3
|
-
# blksize_t, in_addr_t is not yet part of types.conf on linux
|
4
|
-
typedef :long, :blksize_t
|
5
|
-
typedef :uint32, :in_addr_t
|
6
|
-
typedef :ushort, :in_port_t
|
7
|
-
|
8
|
-
|
9
|
-
class Sockaddr < FFI::Struct
|
10
|
-
layout :sa_family, :sa_family_t,
|
11
|
-
:sa_data, [:char, 14]
|
12
|
-
end
|
13
|
-
|
14
|
-
class InAddr < FFI::Struct
|
15
|
-
layout :s_addr, :in_addr_t
|
16
|
-
end
|
17
|
-
|
18
|
-
class SockaddrIn < FFI::Struct
|
19
|
-
layout :sin_family, :sa_family_t,
|
20
|
-
:sin_port, :in_port_t,
|
21
|
-
:sin_addr, InAddr,
|
22
|
-
:sin_zero, [:char, 8]
|
23
|
-
end
|
24
|
-
|
25
|
-
class U6Addr < FFI::Union
|
26
|
-
layout :__u6_addr8, [:uint8, 16],
|
27
|
-
:__u6_addr16, [:uint16, 8]
|
28
|
-
end
|
29
|
-
|
30
|
-
class In6Addr < FFI::Struct
|
31
|
-
layout :__u6_addr, U6Addr
|
32
|
-
end
|
33
|
-
|
34
|
-
class SockaddrIn6 < FFI::Struct
|
35
|
-
layout :sin6_family, :sa_family_t,
|
36
|
-
:sin6_port, :in_port_t,
|
37
|
-
:sin6_flowinfo, :uint32,
|
38
|
-
:sin6_addr, In6Addr,
|
39
|
-
:sin6_scope_id, :uint32
|
40
|
-
end
|
41
|
-
|
42
|
-
class UvAddrinfo < FFI::Struct
|
43
|
-
layout :flags, :int,
|
44
|
-
:family, :int,
|
45
|
-
:socktype, :int,
|
46
|
-
:protocol, :int,
|
47
|
-
:addrlen, :socklen_t,
|
48
|
-
:addr, Sockaddr.by_ref,
|
49
|
-
:canonname, :string,
|
50
|
-
:next, UvAddrinfo.by_ref
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|