libuv 0.10.0 → 0.10.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.
- data/.gitignore +17 -17
- data/.gitmodules +3 -3
- data/.rspec +1 -1
- data/.travis.yml +16 -16
- data/Gemfile +2 -2
- data/LICENSE +23 -23
- data/README.md +82 -73
- data/Rakefile +31 -31
- data/lib/libuv.rb +53 -34
- data/lib/libuv/async.rb +47 -33
- data/lib/libuv/check.rb +55 -48
- data/lib/libuv/error.rb +70 -70
- data/lib/libuv/ext/ext.rb +264 -256
- data/lib/libuv/ext/platform/darwin_x64.rb +12 -12
- data/lib/libuv/ext/platform/linux.rb +7 -7
- data/lib/libuv/ext/platform/unix.rb +13 -13
- data/lib/libuv/ext/platform/windows.rb +26 -26
- data/lib/libuv/ext/tasks.rb +27 -27
- data/lib/libuv/ext/tasks/mac.rb +23 -23
- data/lib/libuv/ext/tasks/unix.rb +23 -23
- data/lib/libuv/ext/tasks/win.rb +11 -11
- data/lib/libuv/ext/types.rb +234 -229
- data/lib/libuv/file.rb +192 -0
- data/lib/libuv/filesystem.rb +233 -0
- data/lib/libuv/fs_event.rb +31 -31
- data/lib/libuv/handle.rb +85 -81
- data/lib/libuv/idle.rb +56 -49
- data/lib/libuv/loop.rb +338 -310
- data/lib/libuv/{assertions.rb → mixins/assertions.rb} +23 -23
- data/lib/libuv/mixins/fs_checks.rb +55 -0
- data/lib/libuv/{listener.rb → mixins/listener.rb} +34 -34
- data/lib/libuv/{net.rb → mixins/net.rb} +37 -37
- data/lib/libuv/{resource.rb → mixins/resource.rb} +27 -27
- data/lib/libuv/{stream.rb → mixins/stream.rb} +143 -123
- data/lib/libuv/pipe.rb +197 -97
- data/lib/libuv/prepare.rb +56 -49
- data/lib/libuv/q.rb +1 -1
- data/lib/libuv/signal.rb +51 -0
- data/lib/libuv/tcp.rb +204 -193
- data/lib/libuv/timer.rb +88 -75
- data/lib/libuv/tty.rb +37 -34
- data/lib/libuv/udp.rb +273 -255
- data/lib/libuv/version.rb +3 -3
- data/lib/libuv/work.rb +63 -61
- data/libuv.gemspec +54 -54
- data/spec/async_spec.rb +60 -60
- data/spec/cpu_spec.rb +10 -0
- data/spec/defer_spec.rb +980 -980
- data/spec/filesystem_spec.rb +119 -0
- data/spec/idle_spec.rb +56 -56
- data/spec/pipe_spec.rb +153 -148
- data/spec/tcp_spec.rb +203 -188
- metadata +73 -49
- checksums.yaml +0 -15
- data/lib/libuv/simple_async.rb +0 -28
data/.gitignore
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
*.sw?
|
2
|
-
.DS_Store
|
3
|
-
coverage
|
4
|
-
rdoc
|
5
|
-
html
|
6
|
-
pkg
|
7
|
-
doc
|
8
|
-
tmp
|
9
|
-
rerun.txt
|
10
|
-
Gemfile.lock
|
11
|
-
.bundle
|
12
|
-
.idea
|
13
|
-
*.rbc
|
14
|
-
.yardoc
|
15
|
-
bin
|
16
|
-
Gemfile-custom
|
17
|
-
ext/*
|
1
|
+
*.sw?
|
2
|
+
.DS_Store
|
3
|
+
coverage
|
4
|
+
rdoc
|
5
|
+
html
|
6
|
+
pkg
|
7
|
+
doc
|
8
|
+
tmp
|
9
|
+
rerun.txt
|
10
|
+
Gemfile.lock
|
11
|
+
.bundle
|
12
|
+
.idea
|
13
|
+
*.rbc
|
14
|
+
.yardoc
|
15
|
+
bin
|
16
|
+
Gemfile-custom
|
17
|
+
ext/*
|
data/.gitmodules
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
[submodule "ext/libuv"]
|
2
|
-
path = ext/libuv
|
3
|
-
url = https://github.com/joyent/libuv.git
|
1
|
+
[submodule "ext/libuv"]
|
2
|
+
path = ext/libuv
|
3
|
+
url = https://github.com/joyent/libuv.git
|
data/.rspec
CHANGED
@@ -1 +1 @@
|
|
1
|
-
--format progress
|
1
|
+
--format progress
|
data/.travis.yml
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- "1.9.3"
|
4
|
-
- "2.0.0"
|
5
|
-
- rbx-20mode
|
6
|
-
- jruby-19mode
|
7
|
-
- jruby-20mode
|
8
|
-
branches:
|
9
|
-
only:
|
10
|
-
- master
|
11
|
-
before_install:
|
12
|
-
- sudo apt-get install subversion
|
13
|
-
- git submodule update --init --recursive
|
14
|
-
- echo "yes" | gem uninstall ffi -a
|
15
|
-
before_script:
|
16
|
-
- rake compile
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- "1.9.3"
|
4
|
+
- "2.0.0"
|
5
|
+
- rbx-20mode
|
6
|
+
- jruby-19mode
|
7
|
+
- jruby-20mode
|
8
|
+
branches:
|
9
|
+
only:
|
10
|
+
- master
|
11
|
+
before_install:
|
12
|
+
- sudo apt-get install subversion
|
13
|
+
- git submodule update --init --recursive
|
14
|
+
- echo "yes" | gem uninstall ffi -a
|
15
|
+
before_script:
|
16
|
+
- rake compile
|
data/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
gemspec
|
1
|
+
source "https://rubygems.org"
|
2
|
+
gemspec
|
data/LICENSE
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-
Copyright (c) 2004-2013 Cotag Media
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
5
|
-
in the Software without restriction, including without limitation the rights
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
copies of the Software, and to permit persons to whom the Software is furnished
|
8
|
-
to do so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in all
|
11
|
-
copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
THE SOFTWARE.
|
20
|
-
|
21
|
-
===
|
22
|
-
|
23
|
-
This license applies to all parts of uvrb (Ruby FFI bindings for libuv only)
|
1
|
+
Copyright (c) 2004-2013 Cotag Media
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is furnished
|
8
|
+
to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
20
|
+
|
21
|
+
===
|
22
|
+
|
23
|
+
This license applies to all parts of uvrb (Ruby FFI bindings for libuv only)
|
24
24
|
Libuv itself [is using Node license](https://github.com/joyent/libuv/blob/master/LICENSE)
|
data/README.md
CHANGED
@@ -1,73 +1,82 @@
|
|
1
|
-
# Libuv FFI bindings for Ruby
|
2
|
-
|
3
|
-
[](https://travis-ci.org/cotag/libuv)
|
4
|
-
|
5
|
-
[Libuv](https://github.com/joyent/libuv) is a cross platform asynchronous IO implementation that powers NodeJS. It supports sockets, both UDP and TCP, filesystem watch, TTY, Pipes and other asynchronous primitives like timer, check, prepare and idle.
|
6
|
-
|
7
|
-
The Libuv gem contains Libuv and a Ruby wrapper that implements [pipelined promises](http://en.wikipedia.org/wiki/Futures_and_promises#Promise_pipelining) for asynchronous flow control
|
8
|
-
|
9
|
-
## Usage
|
10
|
-
|
11
|
-
Create a new libuv loop or use a default one
|
12
|
-
|
13
|
-
```ruby
|
14
|
-
require 'libuv'
|
15
|
-
|
16
|
-
loop = Libuv::Loop.default
|
17
|
-
# or
|
18
|
-
# loop = Libuv::Loop.new
|
19
|
-
|
20
|
-
loop.run do
|
21
|
-
timer = loop.timer do
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
```
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
*
|
62
|
-
*
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
*
|
68
|
-
*
|
69
|
-
*
|
70
|
-
*
|
71
|
-
*
|
72
|
-
*
|
73
|
-
|
1
|
+
# Libuv FFI bindings for Ruby
|
2
|
+
|
3
|
+
[](https://travis-ci.org/cotag/libuv)
|
4
|
+
|
5
|
+
[Libuv](https://github.com/joyent/libuv) is a cross platform asynchronous IO implementation that powers NodeJS. It supports sockets, both UDP and TCP, filesystem watch, TTY, Pipes and other asynchronous primitives like timer, check, prepare and idle.
|
6
|
+
|
7
|
+
The Libuv gem contains Libuv and a Ruby wrapper that implements [pipelined promises](http://en.wikipedia.org/wiki/Futures_and_promises#Promise_pipelining) for asynchronous flow control
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
Create a new libuv loop or use a default one
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
require 'libuv'
|
15
|
+
|
16
|
+
loop = Libuv::Loop.default
|
17
|
+
# or
|
18
|
+
# loop = Libuv::Loop.new
|
19
|
+
|
20
|
+
loop.run do
|
21
|
+
timer = loop.timer do
|
22
|
+
puts "5 seconds passed"
|
23
|
+
timer.close
|
24
|
+
loop.stop
|
25
|
+
end
|
26
|
+
timer.catch do |error|
|
27
|
+
puts "error with timer: #{error}"
|
28
|
+
end
|
29
|
+
timer.finally do
|
30
|
+
puts "timer handle was closed"
|
31
|
+
end
|
32
|
+
timer.start(5000)
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
Check out the [yard documentation](http://rubydoc.info/gems/libuv/Libuv/Loop)
|
37
|
+
|
38
|
+
|
39
|
+
## Installation
|
40
|
+
|
41
|
+
```Shell
|
42
|
+
gem install libuv
|
43
|
+
```
|
44
|
+
|
45
|
+
or
|
46
|
+
|
47
|
+
```shell
|
48
|
+
git clone https://github.com/cotag/libuv.git
|
49
|
+
cd libuv
|
50
|
+
bundle install
|
51
|
+
rake compile
|
52
|
+
```
|
53
|
+
|
54
|
+
### Prerequisites
|
55
|
+
|
56
|
+
* The installation requires __subversion__ to be installed on your system and available on the PATH
|
57
|
+
* Windows users will require a copy of Visual Studio 2010 or later. [Visual Studio Express](http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products) works fine.
|
58
|
+
|
59
|
+
or
|
60
|
+
|
61
|
+
* setting the environmental variable `USE_GLOBAL_LIBUV` will prevent compiling the packaged version.
|
62
|
+
* if you have a compatible `libuv.(so | dylib | dll)` on the PATH already
|
63
|
+
|
64
|
+
|
65
|
+
## What's supported
|
66
|
+
|
67
|
+
* TCP
|
68
|
+
* UDP
|
69
|
+
* TTY
|
70
|
+
* Pipe
|
71
|
+
* Timer
|
72
|
+
* Prepare
|
73
|
+
* Check
|
74
|
+
* Idle
|
75
|
+
* Async
|
76
|
+
* Signals
|
77
|
+
* Filesystem Events
|
78
|
+
* File manipulation
|
79
|
+
* Filesystem manipulation
|
80
|
+
* Errors
|
81
|
+
* Work queue (thread pool)
|
82
|
+
|
data/Rakefile
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rspec/core/rake_task' # testing framework
|
3
|
-
require 'yard' # yard documentation
|
4
|
-
require 'ffi' # loads the extension
|
5
|
-
require 'rake/clean' # for the :clobber rake task
|
6
|
-
require 'libuv/ext/tasks' # platform specific rake tasks used by compile
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
# By default we don't run network tests
|
11
|
-
task :default => :limited_spec
|
12
|
-
RSpec::Core::RakeTask.new(:limited_spec) do |t|
|
13
|
-
# Exclude network tests
|
14
|
-
t.rspec_opts = "--tag ~network
|
15
|
-
end
|
16
|
-
RSpec::Core::RakeTask.new(:spec)
|
17
|
-
|
18
|
-
|
19
|
-
desc "Run all tests"
|
20
|
-
task :test => [:spec]
|
21
|
-
|
22
|
-
|
23
|
-
YARD::Rake::YardocTask.new do |t|
|
24
|
-
t.files = ['lib/**/*.rb', '-', 'ext/README.md', 'README.md']
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
desc "Compile libuv from submodule"
|
29
|
-
task :compile => ["ext/libuv.#{FFI::Platform::LIBSUFFIX}"]
|
30
|
-
|
31
|
-
CLOBBER.include("ext/libuv.#{FFI::Platform::LIBSUFFIX}")
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rspec/core/rake_task' # testing framework
|
3
|
+
require 'yard' # yard documentation
|
4
|
+
require 'ffi' # loads the extension
|
5
|
+
require 'rake/clean' # for the :clobber rake task
|
6
|
+
require 'libuv/ext/tasks' # platform specific rake tasks used by compile
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
# By default we don't run network tests
|
11
|
+
task :default => :limited_spec
|
12
|
+
RSpec::Core::RakeTask.new(:limited_spec) do |t|
|
13
|
+
# Exclude network tests
|
14
|
+
t.rspec_opts = "--tag ~network"
|
15
|
+
end
|
16
|
+
RSpec::Core::RakeTask.new(:spec)
|
17
|
+
|
18
|
+
|
19
|
+
desc "Run all tests"
|
20
|
+
task :test => [:spec]
|
21
|
+
|
22
|
+
|
23
|
+
YARD::Rake::YardocTask.new do |t|
|
24
|
+
t.files = ['lib/**/*.rb', '-', 'ext/README.md', 'README.md']
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
desc "Compile libuv from submodule"
|
29
|
+
task :compile => ["ext/libuv.#{FFI::Platform::LIBSUFFIX}"]
|
30
|
+
|
31
|
+
CLOBBER.include("ext/libuv.#{FFI::Platform::LIBSUFFIX}")
|
data/lib/libuv.rb
CHANGED
@@ -1,34 +1,53 @@
|
|
1
|
-
require 'forwardable'
|
2
|
-
require 'ffi'
|
3
|
-
|
4
|
-
module Libuv
|
5
|
-
require 'libuv/ext/ext' # The libuv ffi ext
|
6
|
-
require 'libuv/
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
#
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
1
|
+
require 'forwardable'
|
2
|
+
require 'ffi'
|
3
|
+
|
4
|
+
module Libuv
|
5
|
+
require 'libuv/ext/ext' # The libuv ffi ext
|
6
|
+
require 'libuv/error' # List of errors (matching those in uv.h)
|
7
|
+
require 'libuv/q' # The promise library
|
8
|
+
|
9
|
+
require 'libuv/mixins/assertions' # Common code to check arguments
|
10
|
+
require 'libuv/mixins/fs_checks' # Common code to check file system results
|
11
|
+
require 'libuv/mixins/resource' # Common code to check for errors
|
12
|
+
require 'libuv/mixins/listener' # Common callback code
|
13
|
+
require 'libuv/mixins/stream' # For all libuv streams (tcp, pipes, tty)
|
14
|
+
require 'libuv/mixins/net' # Common functions for tcp and udp
|
15
|
+
|
16
|
+
# -- The classes required for a loop instance --
|
17
|
+
require 'libuv/handle' # Base class for most libuv functionality
|
18
|
+
require 'libuv/async' # Provide a threadsafe way to signal the event loop
|
19
|
+
require 'libuv/timer' # High resolution timer
|
20
|
+
require 'libuv/loop' # The libuv reactor or event loop
|
21
|
+
# --
|
22
|
+
|
23
|
+
require 'libuv/filesystem' # Async directory manipulation
|
24
|
+
require 'libuv/fs_event' # Notifies of changes to files and folders as they occur
|
25
|
+
require 'libuv/prepare' # Called at the end of a loop cycle
|
26
|
+
require 'libuv/signal' # Used to handle OS signals
|
27
|
+
require 'libuv/check' # Called before processing events on the loop
|
28
|
+
require 'libuv/file' # Async file reading and writing
|
29
|
+
require 'libuv/idle' # Called when there are no events to process
|
30
|
+
require 'libuv/work' # Provide work to be completed on another thread (thread pool)
|
31
|
+
require 'libuv/udp' # Communicate over UDP
|
32
|
+
|
33
|
+
# Streams
|
34
|
+
require 'libuv/pipe' # Communicate over Pipes
|
35
|
+
require 'libuv/tcp' # Communicate over TCP
|
36
|
+
require 'libuv/tty' # Terminal output
|
37
|
+
|
38
|
+
|
39
|
+
# Returns the number of CPU cores on the host platform
|
40
|
+
#
|
41
|
+
# @return [Fixnum, nil] representing the number of CPU cores or nil if failed
|
42
|
+
def self.cpu_count
|
43
|
+
cpu_info = FFI::MemoryPointer.new(:pointer)
|
44
|
+
cpu_count = FFI::MemoryPointer.new(:int)
|
45
|
+
if ::Libuv::Ext.cpu_info(cpu_info, cpu_count) >= 0
|
46
|
+
count = cpu_count.read_int
|
47
|
+
::Libuv::Ext.free_cpu_info(cpu_info.read_pointer, count)
|
48
|
+
return count
|
49
|
+
else
|
50
|
+
return nil
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/libuv/async.rb
CHANGED
@@ -1,33 +1,47 @@
|
|
1
|
-
module Libuv
|
2
|
-
class Async < Handle
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
1
|
+
module Libuv
|
2
|
+
class Async < Handle
|
3
|
+
|
4
|
+
|
5
|
+
# @param loop [::Libuv::Loop] loop this async callback will be associated
|
6
|
+
def initialize(loop, callback = nil, &blk)
|
7
|
+
@loop = loop
|
8
|
+
@callback = callback || blk
|
9
|
+
async_ptr = ::Libuv::Ext.create_handle(:uv_async)
|
10
|
+
error = check_result(::Libuv::Ext.async_init(loop.handle, async_ptr, callback(:on_async)))
|
11
|
+
|
12
|
+
super(async_ptr, error)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Triggers a notify event, calling everything in the notify chain
|
16
|
+
def call
|
17
|
+
return if @closed
|
18
|
+
error = check_result ::Libuv::Ext.async_send(handle)
|
19
|
+
reject(error) if error
|
20
|
+
end
|
21
|
+
|
22
|
+
# Used to update the callback that will be triggered when async is called
|
23
|
+
#
|
24
|
+
# @param callback [Proc] the callback to be called on loop prepare
|
25
|
+
def progress(callback = nil, &blk)
|
26
|
+
@callback = callback || blk
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
|
33
|
+
def on_async(handle, status)
|
34
|
+
e = check_result(status)
|
35
|
+
|
36
|
+
if e
|
37
|
+
reject(e)
|
38
|
+
else
|
39
|
+
begin
|
40
|
+
@callback.call
|
41
|
+
rescue Exception => e
|
42
|
+
@loop.log :error, :async_cb, e
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|