libuv 2.0.1 → 2.0.2
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/ext/libuv/AUTHORS +4 -0
- data/ext/libuv/ChangeLog +41 -0
- data/ext/libuv/appveyor.yml +1 -1
- data/ext/libuv/configure.ac +1 -1
- data/ext/libuv/docs/src/errors.rst +4 -2
- data/ext/libuv/docs/src/stream.rst +2 -0
- data/ext/libuv/include/uv-version.h +1 -1
- data/ext/libuv/src/unix/fs.c +53 -30
- data/ext/libuv/src/unix/stream.c +20 -0
- data/ext/libuv/src/unix/udp.c +4 -2
- data/ext/libuv/src/uv-common.c +17 -5
- data/ext/libuv/src/win/fs.c +25 -20
- data/ext/libuv/src/win/tcp.c +9 -0
- data/ext/libuv/test/benchmark-fs-stat.c +1 -1
- data/ext/libuv/test/echo-server.c +1 -1
- data/ext/libuv/test/runner-unix.c +3 -7
- data/ext/libuv/test/test-fs-event.c +148 -137
- data/ext/libuv/test/test-fs.c +171 -154
- data/ext/libuv/test/test-list.h +2 -0
- data/ext/libuv/test/test-signal-multiple-loops.c +1 -0
- data/ext/libuv/test/test-spawn.c +18 -17
- data/ext/libuv/test/test-threadpool-cancel.c +4 -2
- data/lib/libuv/mixins/listener.rb +2 -8
- data/lib/libuv/mixins/stream.rb +2 -1
- data/lib/libuv/version.rb +1 -1
- metadata +2 -2
data/ext/libuv/test/test-list.h
CHANGED
@@ -275,6 +275,7 @@ TEST_DECLARE (fs_scandir_file)
|
|
275
275
|
TEST_DECLARE (fs_open_dir)
|
276
276
|
TEST_DECLARE (fs_rename_to_existing_file)
|
277
277
|
TEST_DECLARE (fs_write_multiple_bufs)
|
278
|
+
TEST_DECLARE (fs_read_write_null_arguments)
|
278
279
|
TEST_DECLARE (fs_write_alotof_bufs)
|
279
280
|
TEST_DECLARE (fs_write_alotof_bufs_with_offset)
|
280
281
|
TEST_DECLARE (threadpool_queue_work_simple)
|
@@ -690,6 +691,7 @@ TASK_LIST_START
|
|
690
691
|
TEST_ENTRY (fs_write_multiple_bufs)
|
691
692
|
TEST_ENTRY (fs_write_alotof_bufs)
|
692
693
|
TEST_ENTRY (fs_write_alotof_bufs_with_offset)
|
694
|
+
TEST_ENTRY (fs_read_write_null_arguments)
|
693
695
|
TEST_ENTRY (threadpool_queue_work_simple)
|
694
696
|
TEST_ENTRY (threadpool_queue_work_einval)
|
695
697
|
TEST_ENTRY (threadpool_multiple_event_loops)
|
data/ext/libuv/test/test-spawn.c
CHANGED
@@ -277,7 +277,7 @@ TEST_IMPL(spawn_stdout_to_file) {
|
|
277
277
|
|
278
278
|
init_process_options("spawn_helper2", exit_cb);
|
279
279
|
|
280
|
-
r = uv_fs_open(
|
280
|
+
r = uv_fs_open(NULL, &fs_req, "stdout_file", O_CREAT | O_RDWR,
|
281
281
|
S_IRUSR | S_IWUSR, NULL);
|
282
282
|
ASSERT(r != -1);
|
283
283
|
uv_fs_req_cleanup(&fs_req);
|
@@ -300,11 +300,11 @@ TEST_IMPL(spawn_stdout_to_file) {
|
|
300
300
|
ASSERT(close_cb_called == 1);
|
301
301
|
|
302
302
|
buf = uv_buf_init(output, sizeof(output));
|
303
|
-
r = uv_fs_read(
|
303
|
+
r = uv_fs_read(NULL, &fs_req, file, &buf, 1, 0, NULL);
|
304
304
|
ASSERT(r == 12);
|
305
305
|
uv_fs_req_cleanup(&fs_req);
|
306
306
|
|
307
|
-
r = uv_fs_close(
|
307
|
+
r = uv_fs_close(NULL, &fs_req, file, NULL);
|
308
308
|
ASSERT(r == 0);
|
309
309
|
uv_fs_req_cleanup(&fs_req);
|
310
310
|
|
@@ -331,7 +331,7 @@ TEST_IMPL(spawn_stdout_and_stderr_to_file) {
|
|
331
331
|
|
332
332
|
init_process_options("spawn_helper6", exit_cb);
|
333
333
|
|
334
|
-
r = uv_fs_open(
|
334
|
+
r = uv_fs_open(NULL, &fs_req, "stdout_file", O_CREAT | O_RDWR,
|
335
335
|
S_IRUSR | S_IWUSR, NULL);
|
336
336
|
ASSERT(r != -1);
|
337
337
|
uv_fs_req_cleanup(&fs_req);
|
@@ -356,11 +356,11 @@ TEST_IMPL(spawn_stdout_and_stderr_to_file) {
|
|
356
356
|
ASSERT(close_cb_called == 1);
|
357
357
|
|
358
358
|
buf = uv_buf_init(output, sizeof(output));
|
359
|
-
r = uv_fs_read(
|
359
|
+
r = uv_fs_read(NULL, &fs_req, file, &buf, 1, 0, NULL);
|
360
360
|
ASSERT(r == 27);
|
361
361
|
uv_fs_req_cleanup(&fs_req);
|
362
362
|
|
363
|
-
r = uv_fs_close(
|
363
|
+
r = uv_fs_close(NULL, &fs_req, file, NULL);
|
364
364
|
ASSERT(r == 0);
|
365
365
|
uv_fs_req_cleanup(&fs_req);
|
366
366
|
|
@@ -389,7 +389,7 @@ TEST_IMPL(spawn_stdout_and_stderr_to_file2) {
|
|
389
389
|
init_process_options("spawn_helper6", exit_cb);
|
390
390
|
|
391
391
|
/* Replace stderr with our file */
|
392
|
-
r = uv_fs_open(
|
392
|
+
r = uv_fs_open(NULL,
|
393
393
|
&fs_req,
|
394
394
|
"stdout_file",
|
395
395
|
O_CREAT | O_RDWR,
|
@@ -418,11 +418,11 @@ TEST_IMPL(spawn_stdout_and_stderr_to_file2) {
|
|
418
418
|
ASSERT(close_cb_called == 1);
|
419
419
|
|
420
420
|
buf = uv_buf_init(output, sizeof(output));
|
421
|
-
r = uv_fs_read(
|
421
|
+
r = uv_fs_read(NULL, &fs_req, file, &buf, 1, 0, NULL);
|
422
422
|
ASSERT(r == 27);
|
423
423
|
uv_fs_req_cleanup(&fs_req);
|
424
424
|
|
425
|
-
r = uv_fs_close(
|
425
|
+
r = uv_fs_close(NULL, &fs_req, file, NULL);
|
426
426
|
ASSERT(r == 0);
|
427
427
|
uv_fs_req_cleanup(&fs_req);
|
428
428
|
|
@@ -456,7 +456,7 @@ TEST_IMPL(spawn_stdout_and_stderr_to_file_swap) {
|
|
456
456
|
init_process_options("spawn_helper6", exit_cb);
|
457
457
|
|
458
458
|
/* open 'stdout_file' and replace STDOUT_FILENO with it */
|
459
|
-
r = uv_fs_open(
|
459
|
+
r = uv_fs_open(NULL,
|
460
460
|
&fs_req,
|
461
461
|
"stdout_file",
|
462
462
|
O_CREAT | O_RDWR,
|
@@ -468,7 +468,7 @@ TEST_IMPL(spawn_stdout_and_stderr_to_file_swap) {
|
|
468
468
|
ASSERT(stdout_file != -1);
|
469
469
|
|
470
470
|
/* open 'stderr_file' and replace STDERR_FILENO with it */
|
471
|
-
r = uv_fs_open(
|
471
|
+
r = uv_fs_open(NULL, &fs_req, "stderr_file", O_CREAT | O_RDWR,
|
472
472
|
S_IRUSR | S_IWUSR, NULL);
|
473
473
|
ASSERT(r != -1);
|
474
474
|
uv_fs_req_cleanup(&fs_req);
|
@@ -497,11 +497,11 @@ TEST_IMPL(spawn_stdout_and_stderr_to_file_swap) {
|
|
497
497
|
buf = uv_buf_init(output, sizeof(output));
|
498
498
|
|
499
499
|
/* check the content of stdout_file */
|
500
|
-
r = uv_fs_read(
|
500
|
+
r = uv_fs_read(NULL, &fs_req, stdout_file, &buf, 1, 0, NULL);
|
501
501
|
ASSERT(r >= 15);
|
502
502
|
uv_fs_req_cleanup(&fs_req);
|
503
503
|
|
504
|
-
r = uv_fs_close(
|
504
|
+
r = uv_fs_close(NULL, &fs_req, stdout_file, NULL);
|
505
505
|
ASSERT(r == 0);
|
506
506
|
uv_fs_req_cleanup(&fs_req);
|
507
507
|
|
@@ -509,11 +509,11 @@ TEST_IMPL(spawn_stdout_and_stderr_to_file_swap) {
|
|
509
509
|
ASSERT(strncmp("hello errworld\n", output, 15) == 0);
|
510
510
|
|
511
511
|
/* check the content of stderr_file */
|
512
|
-
r = uv_fs_read(
|
512
|
+
r = uv_fs_read(NULL, &fs_req, stderr_file, &buf, 1, 0, NULL);
|
513
513
|
ASSERT(r >= 12);
|
514
514
|
uv_fs_req_cleanup(&fs_req);
|
515
515
|
|
516
|
-
r = uv_fs_close(
|
516
|
+
r = uv_fs_close(NULL, &fs_req, stderr_file, NULL);
|
517
517
|
ASSERT(r == 0);
|
518
518
|
uv_fs_req_cleanup(&fs_req);
|
519
519
|
|
@@ -1399,8 +1399,9 @@ TEST_IMPL(spawn_fs_open) {
|
|
1399
1399
|
uv_buf_t buf;
|
1400
1400
|
uv_stdio_container_t stdio[1];
|
1401
1401
|
|
1402
|
-
fd = uv_fs_open(
|
1402
|
+
fd = uv_fs_open(NULL, &fs_req, "/dev/null", O_RDWR, 0, NULL);
|
1403
1403
|
ASSERT(fd >= 0);
|
1404
|
+
uv_fs_req_cleanup(&fs_req);
|
1404
1405
|
|
1405
1406
|
init_process_options("spawn_helper8", exit_cb);
|
1406
1407
|
|
@@ -1417,7 +1418,7 @@ TEST_IMPL(spawn_fs_open) {
|
|
1417
1418
|
ASSERT(0 == uv_write(&write_req, (uv_stream_t*) &in, &buf, 1, write_cb));
|
1418
1419
|
|
1419
1420
|
ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
|
1420
|
-
ASSERT(0 == uv_fs_close(
|
1421
|
+
ASSERT(0 == uv_fs_close(NULL, &fs_req, fd, NULL));
|
1421
1422
|
|
1422
1423
|
ASSERT(exit_cb_called == 1);
|
1423
1424
|
ASSERT(close_cb_called == 2); /* One for `in`, one for process */
|
@@ -279,10 +279,12 @@ TEST_IMPL(threadpool_cancel_fs) {
|
|
279
279
|
uv_fs_t reqs[25];
|
280
280
|
uv_loop_t* loop;
|
281
281
|
unsigned n;
|
282
|
+
uv_buf_t iov;
|
282
283
|
|
283
284
|
INIT_CANCEL_INFO(&ci, reqs);
|
284
285
|
loop = uv_default_loop();
|
285
286
|
saturate_threadpool();
|
287
|
+
iov = uv_buf_init(NULL, 0);
|
286
288
|
|
287
289
|
/* Needs to match ARRAY_SIZE(fs_reqs). */
|
288
290
|
n = 0;
|
@@ -300,7 +302,7 @@ TEST_IMPL(threadpool_cancel_fs) {
|
|
300
302
|
ASSERT(0 == uv_fs_lstat(loop, reqs + n++, "/", fs_cb));
|
301
303
|
ASSERT(0 == uv_fs_mkdir(loop, reqs + n++, "/", 0, fs_cb));
|
302
304
|
ASSERT(0 == uv_fs_open(loop, reqs + n++, "/", 0, 0, fs_cb));
|
303
|
-
ASSERT(0 == uv_fs_read(loop, reqs + n++, 0,
|
305
|
+
ASSERT(0 == uv_fs_read(loop, reqs + n++, 0, &iov, 1, 0, fs_cb));
|
304
306
|
ASSERT(0 == uv_fs_scandir(loop, reqs + n++, "/", 0, fs_cb));
|
305
307
|
ASSERT(0 == uv_fs_readlink(loop, reqs + n++, "/", fs_cb));
|
306
308
|
ASSERT(0 == uv_fs_rename(loop, reqs + n++, "/", "/", fs_cb));
|
@@ -310,7 +312,7 @@ TEST_IMPL(threadpool_cancel_fs) {
|
|
310
312
|
ASSERT(0 == uv_fs_symlink(loop, reqs + n++, "/", "/", 0, fs_cb));
|
311
313
|
ASSERT(0 == uv_fs_unlink(loop, reqs + n++, "/", fs_cb));
|
312
314
|
ASSERT(0 == uv_fs_utime(loop, reqs + n++, "/", 0, 0, fs_cb));
|
313
|
-
ASSERT(0 == uv_fs_write(loop, reqs + n++, 0,
|
315
|
+
ASSERT(0 == uv_fs_write(loop, reqs + n++, 0, &iov, 1, 0, fs_cb));
|
314
316
|
ASSERT(n == ARRAY_SIZE(reqs));
|
315
317
|
|
316
318
|
ASSERT(0 == uv_timer_init(loop, &ci.timer_handle));
|
@@ -12,7 +12,7 @@ module Libuv
|
|
12
12
|
def dispatch_callback(func_name, lookup, args)
|
13
13
|
instance_id = __send__(lookup, *args)
|
14
14
|
inst = @callback_lookup[instance_id]
|
15
|
-
inst.__send__(func_name, *args)
|
15
|
+
inst.__send__(func_name, *args)
|
16
16
|
end
|
17
17
|
|
18
18
|
def define_callback(function:, params: [:pointer], ret_val: :void, lookup: :default_lookup)
|
@@ -30,13 +30,7 @@ module Libuv
|
|
30
30
|
|
31
31
|
|
32
32
|
# Provide accessor methods to the class level instance variables
|
33
|
-
|
34
|
-
@callback_lookup
|
35
|
-
end
|
36
|
-
|
37
|
-
def callback_funcs
|
38
|
-
@callback_funcs
|
39
|
-
end
|
33
|
+
attr_reader :callback_lookup, :callback_funcs
|
40
34
|
|
41
35
|
|
42
36
|
# This function is used to work out the instance the callback is for
|
data/lib/libuv/mixins/stream.rb
CHANGED
@@ -43,7 +43,8 @@ module Libuv
|
|
43
43
|
# Shutsdown the writes on the handle waiting until the last write is complete before triggering the callback
|
44
44
|
def shutdown
|
45
45
|
return if @closed
|
46
|
-
|
46
|
+
req = ::Libuv::Ext.allocate_request_shutdown
|
47
|
+
error = check_result ::Libuv::Ext.shutdown(req, handle, callback(:on_shutdown, req.address))
|
47
48
|
reject(error) if error
|
48
49
|
end
|
49
50
|
|
data/lib/libuv/version.rb
CHANGED
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: 2.0.
|
4
|
+
version: 2.0.2
|
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: 2015-08-
|
12
|
+
date: 2015-08-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|