libuv 2.0.3 → 2.0.4
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/lib/libuv/mixins/listener.rb +3 -3
- data/lib/libuv/mixins/stream.rb +2 -1
- data/lib/libuv/q.rb +4 -2
- data/lib/libuv/version.rb +1 -1
- data/spec/async_spec.rb +1 -0
- data/spec/zen_spec.rb +35 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dc82e51b4569c6be6d73639176fbb4779a5b4d62
|
|
4
|
+
data.tar.gz: 711888d208a4f2719efaa20c52d3815645202ed4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a6a084029d33260ce7671932c32be0ec450d5c0c9f01e3ea991b2e685b73c89912fe724cec39d4b4e81cd7665eb0d017aab9e3de0c2c547177ab9a23d76e809a
|
|
7
|
+
data.tar.gz: 8a77e498c41b77c819f4eeff6baee7048e053b3ff36a9373f14b7e62c743dba92ccc3d40f609389e1cb8ee8d0a1ecd6e7e004b5ee7a4eb18a779f44e3cba290a
|
|
@@ -15,7 +15,7 @@ module Libuv
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
def define_callback(function:, params: [:pointer], ret_val: :void, lookup: :default_lookup)
|
|
18
|
-
@callback_funcs[function] = FFI::Function.new(ret_val, params) do |*args|
|
|
18
|
+
@callback_funcs[function] = ::FFI::Function.new(ret_val, params) do |*args|
|
|
19
19
|
dispatch_callback(function, lookup, args)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -41,8 +41,8 @@ module Libuv
|
|
|
41
41
|
|
|
42
42
|
def self.included(base)
|
|
43
43
|
base.instance_variable_set(:@callback_funcs, {})
|
|
44
|
-
base.instance_variable_set(:@callback_lookup, ThreadSafe::Cache.new)
|
|
45
|
-
base.instance_variable_set(:@callback_lock, Mutex.new)
|
|
44
|
+
base.instance_variable_set(:@callback_lookup, ::ThreadSafe::Cache.new)
|
|
45
|
+
base.instance_variable_set(:@callback_lock, ::Mutex.new)
|
|
46
46
|
base.extend(ClassMethods)
|
|
47
47
|
end
|
|
48
48
|
|
data/lib/libuv/mixins/stream.rb
CHANGED
|
@@ -70,7 +70,7 @@ module Libuv
|
|
|
70
70
|
assert_type(String, data, WRITE_ERROR)
|
|
71
71
|
|
|
72
72
|
buffer1 = ::FFI::MemoryPointer.from_string(data)
|
|
73
|
-
buffer = ::Libuv::Ext.buf_init(buffer1, data.
|
|
73
|
+
buffer = ::Libuv::Ext.buf_init(buffer1, data.bytesize)
|
|
74
74
|
|
|
75
75
|
# local as this variable will be available until the handle is closed
|
|
76
76
|
@write_callbacks ||= {}
|
|
@@ -174,6 +174,7 @@ module Libuv
|
|
|
174
174
|
end
|
|
175
175
|
|
|
176
176
|
def on_shutdown(req, status)
|
|
177
|
+
cleanup_callbacks(req.address)
|
|
177
178
|
::Libuv::Ext.free(req)
|
|
178
179
|
@close_error = check_result(status)
|
|
179
180
|
close
|
data/lib/libuv/q.rb
CHANGED
|
@@ -156,11 +156,11 @@ module Libuv
|
|
|
156
156
|
|
|
157
157
|
|
|
158
158
|
def pending
|
|
159
|
-
@defer.
|
|
159
|
+
@defer.pending
|
|
160
160
|
end
|
|
161
161
|
|
|
162
162
|
def value
|
|
163
|
-
@defer.
|
|
163
|
+
@defer.value
|
|
164
164
|
end
|
|
165
165
|
end
|
|
166
166
|
|
|
@@ -226,6 +226,8 @@ module Libuv
|
|
|
226
226
|
@value = nil
|
|
227
227
|
@loop = loop
|
|
228
228
|
end
|
|
229
|
+
|
|
230
|
+
attr_reader :pending, :value
|
|
229
231
|
|
|
230
232
|
#
|
|
231
233
|
# resolves the derived promise with the value. If the value is a rejection constructed via
|
data/lib/libuv/version.rb
CHANGED
data/spec/async_spec.rb
CHANGED
data/spec/zen_spec.rb
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'libuv'
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
describe Libuv::Listener do
|
|
5
|
+
it "should ensure there are no remaining object references in callbacks" do
|
|
6
|
+
require 'objspace'
|
|
7
|
+
|
|
8
|
+
checked = []
|
|
9
|
+
|
|
10
|
+
# These are created by loop objects and are never cleaned up
|
|
11
|
+
# This is OK as the loops are expected to execute for the life of the application
|
|
12
|
+
except = [::Libuv::Async, ::Libuv::Timer]
|
|
13
|
+
|
|
14
|
+
ObjectSpace.each_object(Class) do |cls|
|
|
15
|
+
next unless cls.ancestors.include? ::Libuv::Handle
|
|
16
|
+
next if checked.include? cls
|
|
17
|
+
checked << cls
|
|
18
|
+
|
|
19
|
+
values = cls.callback_lookup.values
|
|
20
|
+
values.select! {|val| except.include?(val.class) ? false : val.class }
|
|
21
|
+
|
|
22
|
+
if values.length > 0
|
|
23
|
+
puts "\nMemory Leak in #{cls} with #{values.length} left over objects"
|
|
24
|
+
puts "\nChecked #{checked.length} classes"
|
|
25
|
+
puts "\n\nObjects are:"
|
|
26
|
+
values.each do |val|
|
|
27
|
+
puts "\n#{val}\n"
|
|
28
|
+
end
|
|
29
|
+
raise 'Free the machines!'
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
expect(checked.length).to be > 3
|
|
34
|
+
end
|
|
35
|
+
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: 2.0.
|
|
4
|
+
version: 2.0.4
|
|
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-21 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: ffi
|
|
@@ -490,6 +490,7 @@ files:
|
|
|
490
490
|
- spec/pipe_spec.rb
|
|
491
491
|
- spec/tcp_spec.rb
|
|
492
492
|
- spec/udp_spec.rb
|
|
493
|
+
- spec/zen_spec.rb
|
|
493
494
|
homepage: https://github.com/cotag/libuv
|
|
494
495
|
licenses:
|
|
495
496
|
- MIT
|
|
@@ -525,4 +526,5 @@ test_files:
|
|
|
525
526
|
- spec/pipe_spec.rb
|
|
526
527
|
- spec/tcp_spec.rb
|
|
527
528
|
- spec/udp_spec.rb
|
|
529
|
+
- spec/zen_spec.rb
|
|
528
530
|
has_rdoc:
|