libuv 0.10.2 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 769f10cadb566b542368277dfee691a5aa2af059
4
+ data.tar.gz: 8114fb75a4da94c6341e6ead1faf5d59182c9245
5
+ SHA512:
6
+ metadata.gz: 33e0394111e14048717934b2cffbc6f37d660117f6bc871eb7bb4da8089c0a303629b28febb6ee762f870039968029f620c35303b68302f1b8e1fc18bdbd2522
7
+ data.tar.gz: b1d5f5af132c26fdb88d732c188f6b067714512e3466feb63bef970f56374f961810c1a63d8d5e8c9301af28f23e0b70aae7a6bf917e07fd38c0b6e806565216
data/lib/libuv/ext/ext.rb CHANGED
@@ -85,9 +85,7 @@ module Libuv
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
87
 
88
- attach_function :buf_init, :uv_buf_init, [:pointer, :size_t], :uv_buf_t, :blocking => true
89
- attach_function :strlcpy, :uv_strlcpy, [:string, :string, :size_t], :size_t, :blocking => true
90
- attach_function :strlcat, :uv_strlcat, [:string, :string, :size_t], :size_t, :blocking => true
88
+ attach_function :buf_init, :uv_buf_init, [:pointer, :size_t], UvBuf.by_value, :blocking => true
91
89
 
92
90
  attach_function :listen, :uv_listen, [:uv_stream_t, :int, :uv_connection_cb], :int, :blocking => true
93
91
  attach_function :accept, :uv_accept, [:uv_stream_t, :uv_stream_t], :int, :blocking => true
@@ -101,21 +99,18 @@ module Libuv
101
99
  attach_function :shutdown, :uv_shutdown, [:uv_shutdown_t, :uv_stream_t, :uv_shutdown_cb], :int, :blocking => true
102
100
 
103
101
  attach_function :tcp_init, :uv_tcp_init, [:uv_loop_t, :uv_tcp_t], :int, :blocking => true
104
- #attach_function :tcp_open, :uv_tcp_open, [:uv_tcp_t, :uv_os_sock_t], :int, :blocking => true
102
+ attach_function :tcp_open, :uv_tcp_open, [:uv_tcp_t, :uv_os_sock_t], :int, :blocking => true
105
103
  attach_function :tcp_nodelay, :uv_tcp_nodelay, [:uv_tcp_t, :int], :int, :blocking => true
106
104
  attach_function :tcp_keepalive, :uv_tcp_keepalive, [:uv_tcp_t, :int, :uint], :int, :blocking => true
107
105
  attach_function :tcp_simultaneous_accepts, :uv_tcp_simultaneous_accepts, [:uv_tcp_t, :int], :int, :blocking => true
108
106
  attach_function :tcp_bind, :uv_tcp_bind, [:uv_tcp_t, :sockaddr_in], :int, :blocking => true
109
- attach_function :tcp_bind6, :uv_tcp_bind6, [:uv_tcp_t, :sockaddr_in6], :int, :blocking => true
110
107
  attach_function :tcp_getsockname, :uv_tcp_getsockname, [:uv_tcp_t, :pointer, :pointer], :int, :blocking => true
111
108
  attach_function :tcp_getpeername, :uv_tcp_getpeername, [:uv_tcp_t, :pointer, :pointer], :int, :blocking => true
112
109
  attach_function :tcp_connect, :uv_tcp_connect, [:uv_connect_t, :uv_tcp_t, :sockaddr_in, :uv_connect_cb], :int, :blocking => true
113
- attach_function :tcp_connect6, :uv_tcp_connect6, [:uv_connect_t, :uv_tcp_t, :sockaddr_in6, :uv_connect_cb], :int, :blocking => true
114
110
 
115
111
  attach_function :udp_init, :uv_udp_init, [:uv_loop_t, :uv_udp_t], :int, :blocking => true
116
- #attach_function :udp_open, :uv_udp_open, [:uv_udp_t, :uv_os_sock_t], :int, :blocking => true
112
+ attach_function :udp_open, :uv_udp_open, [:uv_udp_t, :uv_os_sock_t], :int, :blocking => true
117
113
  attach_function :udp_bind, :uv_udp_bind, [:uv_udp_t, :sockaddr_in, :uint], :int, :blocking => true
118
- attach_function :udp_bind6, :uv_udp_bind6, [:uv_udp_t, :sockaddr_in6, :uint], :int, :blocking => true
119
114
  attach_function :udp_getsockname, :uv_udp_getsockname, [:uv_udp_t, :pointer, :pointer], :int, :blocking => true
120
115
  attach_function :udp_set_membership, :uv_udp_set_membership, [:uv_udp_t, :string, :string, :uv_membership], :int, :blocking => true
121
116
  attach_function :udp_set_multicast_loop, :uv_udp_set_multicast_loop, [:uv_udp_t, :int], :int, :blocking => true
@@ -123,7 +118,6 @@ module Libuv
123
118
  attach_function :udp_set_broadcast, :uv_udp_set_broadcast, [:uv_udp_t, :int], :int, :blocking => true
124
119
  attach_function :udp_set_ttl, :uv_udp_set_ttl, [:uv_udp_t, :int], :int, :blocking => true
125
120
  attach_function :udp_send, :uv_udp_send, [:uv_udp_send_t, :uv_udp_t, :pointer, :int, :sockaddr_in, :uv_udp_send_cb], :int, :blocking => true
126
- attach_function :udp_send6, :uv_udp_send6, [:uv_udp_send_t, :uv_udp_t, :pointer, :int, :sockaddr_in6, :uv_udp_send_cb], :int, :blocking => true
127
121
  attach_function :udp_recv_start, :uv_udp_recv_start, [:uv_udp_t, :uv_alloc_cb, :uv_udp_recv_cb], :int, :blocking => true
128
122
  attach_function :udp_recv_stop, :uv_udp_recv_stop, [:uv_udp_t], :int, :blocking => true
129
123
 
@@ -211,10 +205,10 @@ module Libuv
211
205
 
212
206
  attach_function :fs_event_init, :uv_fs_event_init, [:uv_loop_t, :uv_fs_event_t, :string, :uv_fs_event_cb, :int], :int, :blocking => true
213
207
 
214
- attach_function :ip4_addr, :uv_ip4_addr, [:string, :int], :sockaddr_in, :blocking => true
215
- attach_function :ip6_addr, :uv_ip6_addr, [:string, :int], :sockaddr_in6, :blocking => true
216
- attach_function :ip4_name, :uv_ip4_name, [SockaddrIn.by_ref, :pointer, :size_t], :int, :blocking => true
217
- attach_function :ip6_name, :uv_ip6_name, [SockaddrIn6.by_ref, :pointer, :size_t], :int, :blocking => true
208
+ attach_function :ip4_addr, :uv_ip4_addr, [:string, :int, :sockaddr_in4], :int, :blocking => true
209
+ attach_function :ip6_addr, :uv_ip6_addr, [:string, :int, :sockaddr_in6], :int, :blocking => true
210
+ attach_function :ip4_name, :uv_ip4_name, [:sockaddr_in4, :pointer, :size_t], :int, :blocking => true
211
+ attach_function :ip6_name, :uv_ip6_name, [:sockaddr_in6, :pointer, :size_t], :int, :blocking => true
218
212
  #TODO:: attach_function :inet_ntop, :uv_inet_ntop, [:int, :pointer, ]
219
213
  #TODO:: attach_function :uv_inet_pton
220
214
 
@@ -1,5 +1,7 @@
1
1
  module Libuv
2
2
  module Ext
3
+ typedef :int, :uv_os_sock_t
4
+
3
5
  class UvBuf < FFI::Struct
4
6
  layout :base, :pointer, :len, :size_t
5
7
  end
@@ -10,5 +12,7 @@ module Libuv
10
12
  :st_blksize, :blksize_t, :st_blocks, :blkcnt_t, :st_atime, :time_t,
11
13
  :st_mtime, :time_t, :st_ctime, :time_t
12
14
  end
15
+
16
+ attach_function :ntohs, [:ushort], :ushort, :blocking => true
13
17
  end
14
18
  end
@@ -3,6 +3,8 @@ module Libuv
3
3
  typedef :uint32_t, :in_addr_t
4
4
  typedef :uint16, :in_port_t
5
5
  typedef :int, :mode_t
6
+ # http://stackoverflow.com/questions/1953639/is-it-safe-to-cast-socket-to-int-under-win64
7
+ typedef :int, :uv_os_sock_t
6
8
 
7
9
  module WS2
8
10
  extend FFI::Library
@@ -5,7 +5,7 @@ file 'ext/libuv/uv.xcodeproj' => 'ext/libuv/build/gyp' do
5
5
  abort "Don't know how to build on #{FFI::Platform::ARCH} (yet)" unless target_arch
6
6
 
7
7
  Dir.chdir("ext/libuv") do |path|
8
- system "./gyp_uv -f xcode -Dtarget_arch=#{target_arch} -Dlibrary=shared_library -Dcomponent=shared_library"
8
+ system "./gyp_uv.py -f xcode -Dtarget_arch=#{target_arch} -Dlibrary=shared_library -Dcomponent=shared_library"
9
9
  end
10
10
  end
11
11
 
@@ -5,7 +5,7 @@ file 'ext/libuv/out' => 'ext/libuv/build/gyp' do
5
5
  abort "Don't know how to build on #{FFI::Platform::ARCH} (yet)" unless target_arch
6
6
 
7
7
  Dir.chdir("ext/libuv") do |path|
8
- system "./gyp_uv -f make -Dtarget_arch=#{target_arch} -Dlibrary=shared_library -Dcomponent=shared_library"
8
+ system "./gyp_uv.py -f make -Dtarget_arch=#{target_arch} -Dlibrary=shared_library -Dcomponent=shared_library"
9
9
  end
10
10
  end
11
11
 
@@ -9,11 +9,7 @@ module Libuv
9
9
  require 'libuv/ext/platform/linux.rb' if FFI::Platform.linux?
10
10
  require 'libuv/ext/platform/unix.rb' if FFI::Platform.unix?
11
11
  require 'libuv/ext/platform/darwin_x64.rb' if FFI::Platform.mac? and FFI::Platform::ARCH == 'x86_64'
12
- if FFI::Platform.windows?
13
- require 'libuv/ext/platform/windows.rb'
14
- else
15
- attach_function :ntohs, [:ushort], :ushort, :blocking => true
16
- end
12
+ require 'libuv/ext/platform/windows.rb' if FFI::Platform.windows?
17
13
 
18
14
  enum :uv_handle_type, [
19
15
  :uv_unknown_handle, 0,
@@ -92,8 +88,7 @@ module Libuv
92
88
  :UV_RUN_NOWAIT
93
89
  ]
94
90
 
95
- typedef UvBuf.by_value, :uv_buf_t
96
- typedef UvFSStat.by_value, :uv_fs_stat_t
91
+ typedef UvBuf.by_ref, :uv_buf_t
97
92
 
98
93
 
99
94
  class Sockaddr < FFI::Struct
@@ -114,7 +109,7 @@ module Libuv
114
109
  :sin_zero, [:char, 8]
115
110
  end
116
111
 
117
- typedef SockaddrIn.by_value, :sockaddr_in
112
+ typedef SockaddrIn.by_ref, :sockaddr_in4
118
113
 
119
114
  class U6Addr < FFI::Union
120
115
  layout :__u6_addr8, [:uint8, 16],
@@ -134,7 +129,7 @@ module Libuv
134
129
  :sin6_scope_id, :uint32
135
130
  end
136
131
 
137
- typedef SockaddrIn6.by_value, :sockaddr_in6
132
+ typedef SockaddrIn6.by_ref, :sockaddr_in6
138
133
 
139
134
 
140
135
  class UvTimespec < FFI::Struct
@@ -161,8 +156,7 @@ module Libuv
161
156
  :st_birthtim, UvTimespec
162
157
  end
163
158
 
164
- typedef UvStat.by_value, :uv_stat_t
165
-
159
+ typedef :pointer, :sockaddr_in
166
160
  typedef :pointer, :uv_handle_t
167
161
  typedef :pointer, :uv_fs_event_t
168
162
  typedef :pointer, :uv_fs_poll_t
@@ -205,7 +199,7 @@ module Libuv
205
199
  typedef :int, :events
206
200
  typedef :int, :signal
207
201
 
208
- callback :uv_alloc_cb, [:uv_handle_t, :size_t], :uv_buf_t
202
+ callback :uv_alloc_cb, [:uv_handle_t, :size_t, :uv_buf_t], :void
209
203
  callback :uv_read_cb, [:uv_stream_t, :ssize_t, :uv_buf_t], :void
210
204
  callback :uv_read2_cb, [:uv_pipe_t, :ssize_t, :uv_buf_t, :uv_handle_type], :void
211
205
  callback :uv_write_cb, [:uv_write_t, :status], :void
@@ -227,9 +221,8 @@ module Libuv
227
221
  callback :uv_after_work_cb, [:uv_work_t, :int], :void
228
222
  callback :uv_fs_event_cb, [:uv_fs_event_t, :string, :int, :int], :void
229
223
  callback :uv_fs_poll_cb, [:uv_fs_poll_t, :status, :uv_stat_t, :uv_stat_t], :void
230
- #callback :uv_signal_cb, []
231
224
  callback :uv_udp_send_cb, [:uv_udp_send_t, :int], :void
232
- callback :uv_udp_recv_cb, [:uv_udp_t, :ssize_t, :uv_buf_t, Sockaddr, :uint], :void
225
+ callback :uv_udp_recv_cb, [:uv_udp_t, :ssize_t, :uv_buf_t, Sockaddr.by_ref, :uint], :void
233
226
  callback :uv_cb, [], :void
234
227
  end
235
228
  end
data/lib/libuv/loop.rb CHANGED
@@ -5,19 +5,22 @@ module Libuv
5
5
  include Resource, Assertions
6
6
 
7
7
 
8
+ LOOPS = ThreadSafe::Cache.new
9
+
10
+
8
11
  module ClassMethods
9
12
  # Get default loop
10
13
  #
11
14
  # @return [::Libuv::Loop]
12
15
  def default
13
- create(::Libuv::Ext.default_loop)
16
+ return current || create(::Libuv::Ext.default_loop)
14
17
  end
15
18
 
16
19
  # Create new Libuv loop
17
20
  #
18
21
  # @return [::Libuv::Loop]
19
22
  def new
20
- create(::Libuv::Ext.loop_new)
23
+ return current || create(::Libuv::Ext.loop_new)
21
24
  end
22
25
 
23
26
  # Build a Ruby Libuv loop from an existing loop pointer
@@ -26,6 +29,13 @@ module Libuv
26
29
  def create(pointer)
27
30
  allocate.tap { |i| i.send(:initialize, FFI::AutoPointer.new(pointer, ::Libuv::Ext.method(:loop_delete))) }
28
31
  end
32
+
33
+ # Checks for the existence of a loop on the current thread
34
+ #
35
+ # @return [::Libuv::Loop | nil]
36
+ def current
37
+ LOOPS[Thread.current]
38
+ end
29
39
  end
30
40
  extend ClassMethods
31
41
 
@@ -59,6 +69,8 @@ module Libuv
59
69
 
60
70
  # Create an async call for ending the loop
61
71
  @stop_loop = Async.new @loop do
72
+ LOOPS.delete(@reactor_thread)
73
+ @reactor_thread = nil
62
74
  @process_queue.close
63
75
  @stop_loop.close
64
76
  @next_tick.close
@@ -75,17 +87,19 @@ module Libuv
75
87
  # @yieldparam promise [::Libuv::Q::Promise] Yields a promise that can be used for logging unhandled
76
88
  # exceptions on the loop.
77
89
  def run(run_type = :UV_RUN_DEFAULT)
78
- @loop_notify = @loop.defer
79
-
80
- begin
81
- @reactor_thread = Thread.current
82
- yield @loop_notify.promise if block_given?
83
- ::Libuv::Ext.run(@pointer, run_type) # This is blocking
84
- ensure
85
- @reactor_thread = nil
86
- @run_queue.clear
90
+ if @reactor_thread.nil?
91
+ @loop_notify = @loop.defer
92
+
93
+ begin
94
+ @reactor_thread = Thread.current
95
+ LOOPS[@reactor_thread] = @loop
96
+ yield @loop_notify.promise if block_given?
97
+ ::Libuv::Ext.run(@pointer, run_type) # This is blocking
98
+ ensure
99
+ @reactor_thread = nil
100
+ @run_queue.clear
101
+ end
87
102
  end
88
-
89
103
  @loop
90
104
  end
91
105
 
@@ -139,7 +153,7 @@ module Libuv
139
153
  ::Libuv::Ext.update_time(@pointer)
140
154
  end
141
155
 
142
- # Get current time in microseconds
156
+ # Get current time in milliseconds
143
157
  #
144
158
  # @return [Fixnum]
145
159
  def now
@@ -204,15 +218,15 @@ module Libuv
204
218
  # Get a new Prepare handle
205
219
  #
206
220
  # @return [::Libuv::Prepare]
207
- def prepare
208
- Prepare.new(@loop)
221
+ def prepare(callback = nil, &blk)
222
+ Prepare.new(@loop, callback || blk)
209
223
  end
210
224
 
211
225
  # Get a new Check handle
212
226
  #
213
227
  # @return [::Libuv::Check]
214
- def check
215
- Check.new(@loop)
228
+ def check(callback = nil, &blk)
229
+ Check.new(@loop, callback || blk)
216
230
  end
217
231
 
218
232
  # Get a new Idle handle
@@ -293,7 +307,7 @@ module Libuv
293
307
  callback ||= block
294
308
  assert_block(callback)
295
309
 
296
- if @reactor_thread == Thread.current
310
+ if reactor_thread?
297
311
  block.call
298
312
  else
299
313
  @run_queue << callback
@@ -310,7 +324,7 @@ module Libuv
310
324
  assert_block(callback)
311
325
 
312
326
  @run_queue << callback
313
- if @reactor_thread == Thread.current
327
+ if reactor_thread?
314
328
  # Create a next tick timer
315
329
  if not @next_tick_scheduled
316
330
  @next_tick.start(0)
@@ -334,5 +348,26 @@ module Libuv
334
348
  def stop
335
349
  @stop_loop.call
336
350
  end
351
+
352
+ # True if the calling thread is the same thread as the reactor.
353
+ #
354
+ # @return [Boolean]
355
+ def reactor_thread?
356
+ @reactor_thread == Thread.current
357
+ end
358
+
359
+ # Exposed to allow joining on the thread, when run in a multithreaded environment. Performing other actions on the thread has undefined semantics (read: a dangerous endevor).
360
+ #
361
+ # @return [Thread]
362
+ def reactor_thread
363
+ @reactor_thread
364
+ end
365
+
366
+ # Tells you whether the Libuv reactor loop is currently running.
367
+ #
368
+ # @return [Boolean]
369
+ def reactor_running?
370
+ !@reactor_thread.nil?
371
+ end
337
372
  end
338
373
  end
@@ -3,7 +3,7 @@ module Libuv
3
3
  MSG_NO_PROC = 'no block given'
4
4
 
5
5
  def assert_block(proc, msg = MSG_NO_PROC)
6
- raise ArgumentError, msg, caller if proc.nil?
6
+ raise ArgumentError, msg, caller unless proc.respond_to? :call
7
7
  end
8
8
 
9
9
  def assert_type(type, actual, msg = nil)
@@ -3,10 +3,10 @@ module Libuv
3
3
 
4
4
 
5
5
  def resolve(deferred, rc)
6
- if rc.nil? || rc >= 0
7
- deferred.resolve(nil)
8
- else
6
+ if rc && rc < 0
9
7
  deferred.reject(@loop.lookup_error(rc))
8
+ else
9
+ deferred.resolve(nil)
10
10
  end
11
11
  end
12
12
 
@@ -37,7 +37,7 @@ module Libuv
37
37
  end
38
38
 
39
39
  def write(data)
40
- # NOTE:: Similar to udp.rb -> write
40
+ # NOTE:: Similar to udp.rb -> send
41
41
  deferred = @loop.defer
42
42
  if !@closed
43
43
  begin
@@ -113,8 +113,9 @@ module Libuv
113
113
  end
114
114
  end
115
115
 
116
- def on_allocate(client, suggested_size)
117
- ::Libuv::Ext.buf_init(::Libuv::Ext.malloc(suggested_size), suggested_size)
116
+ def on_allocate(client, suggested_size, buffer)
117
+ buffer[:len] = suggested_size
118
+ buffer[:base] = ::Libuv::Ext.malloc(suggested_size)
118
119
  end
119
120
 
120
121
  def on_read(handle, nread, buf)
@@ -123,10 +124,16 @@ module Libuv
123
124
 
124
125
  if e
125
126
  ::Libuv::Ext.free(base)
126
- reject(e)
127
+ # I assume this is desirable behaviour
128
+ if e.is_a? ::Libuv::Error::EOF
129
+ close # Close gracefully
130
+ else
131
+ reject(e)
132
+ end
127
133
  else
128
134
  data = base.read_string(nread)
129
135
  ::Libuv::Ext.free(base)
136
+
130
137
  begin
131
138
  @progress.call data, self
132
139
  rescue Exception => e
data/lib/libuv/prepare.rb CHANGED
@@ -9,7 +9,7 @@ module Libuv
9
9
  @callback = callback || blk
10
10
 
11
11
  prepare_ptr = ::Libuv::Ext.create_handle(:uv_prepare)
12
- error = check_result(::Libuv::Ext.prepare_init(@pointer, prepare_ptr))
12
+ error = check_result(::Libuv::Ext.prepare_init(loop.handle, prepare_ptr))
13
13
 
14
14
  super(prepare_ptr, error)
15
15
  end
data/lib/libuv/q.rb CHANGED
@@ -146,6 +146,10 @@ module Libuv
146
146
 
147
147
  result.promise
148
148
  end
149
+
150
+ def resolved?
151
+ pending.nil?
152
+ end
149
153
 
150
154
 
151
155
  private
@@ -181,14 +185,30 @@ module Libuv
181
185
 
182
186
  @loop.next_tick {
183
187
  if @error
184
- result.resolve(errback.nil? ? Q.reject(@loop, @response) : errback.call(@response))
188
+ begin
189
+ result.resolve(errback.nil? ? Q.reject(@loop, @response) : errback.call(@response))
190
+ rescue Exception => e
191
+ #warn "Unhandled exception: #{e.message}\n#{e.backtrace.join("\n")}\n"
192
+ result.reject(e)
193
+ @loop.log(:error, :q_reject_cb, e)
194
+ end
185
195
  else
186
- result.resolve(callback.nil? ? @response : callback.call(@response))
196
+ begin
197
+ result.resolve(callback.nil? ? @response : callback.call(@response))
198
+ rescue Exception => e
199
+ #warn "\nUnhandled exception: #{e.message}\n#{e.backtrace.join("\n")}\n"
200
+ result.reject(e)
201
+ @loop.log(:error, :q_resolve_cb, e)
202
+ end
187
203
  end
188
204
  }
189
205
 
190
206
  result.promise
191
207
  end
208
+
209
+ def resolved?
210
+ true
211
+ end
192
212
  end
193
213
 
194
214
 
@@ -241,7 +261,8 @@ module Libuv
241
261
  # Creates a promise object associated with this deferred
242
262
  #
243
263
  def promise
244
- DeferredPromise.new(@loop, self)
264
+ @promise ||= DeferredPromise.new(@loop, self)
265
+ @promise # Should only ever be one per deferred
245
266
  end
246
267
 
247
268
  #
@@ -260,6 +281,10 @@ module Libuv
260
281
  end
261
282
  end
262
283
  end
284
+
285
+ def resolved?
286
+ @pending.nil?
287
+ end
263
288
  end
264
289
 
265
290
 
data/lib/libuv/tcp.rb CHANGED
@@ -33,20 +33,28 @@ module Libuv
33
33
  end
34
34
  end
35
35
 
36
+ def open(fd, binding = true, callback = nil, &blk)
37
+ return if @closed
38
+ if binding
39
+ @on_listen = callback || blk
40
+ else
41
+ @callback = callback || blk
42
+ end
43
+ error = check_result UV.tcp_open(handle, fd)
44
+ reject(error) if error
45
+ end
46
+
36
47
  def accept(callback = nil, &blk)
37
- tcp = nil
38
48
  begin
39
49
  raise RuntimeError, CLOSED_HANDLE_ERROR if @closed
40
50
  tcp = TCP.new(loop, handle)
41
- rescue Exception => e
42
- @loop.log :info, :tcp_accept_failed, e
43
- end
44
- if tcp
45
51
  begin
46
52
  (callback || blk).call(tcp)
47
53
  rescue Exception => e
48
54
  @loop.log :error, :tcp_accept_cb, e
49
55
  end
56
+ rescue Exception => e
57
+ @loop.log :info, :tcp_accept_failed, e
50
58
  end
51
59
  nil
52
60
  end
@@ -124,7 +132,11 @@ module Libuv
124
132
 
125
133
  def on_connect(req, status)
126
134
  ::Libuv::Ext.free(req)
127
- @callback.call(self)
135
+ begin
136
+ @callback.call(self)
137
+ rescue Exception => e
138
+ @loop.log :error, :connect_cb, e
139
+ end
128
140
  end
129
141
 
130
142
 
@@ -144,28 +156,12 @@ module Libuv
144
156
  end
145
157
 
146
158
 
147
- private
159
+ protected
148
160
 
149
161
 
150
162
  def connect_req
151
163
  ::Libuv::Ext.create_request(:uv_connect)
152
164
  end
153
- end
154
-
155
-
156
- class Socket4 < SocketBase
157
-
158
-
159
- private
160
-
161
-
162
- def ip_addr(ip, port)
163
- ::Libuv::Ext.ip4_addr(ip, port)
164
- end
165
-
166
- def tcp_bind
167
- ::Libuv::Ext.tcp_bind(@tcp, @sockaddr)
168
- end
169
165
 
170
166
  def tcp_connect(callback)
171
167
  ::Libuv::Ext.tcp_connect(
@@ -175,30 +171,33 @@ module Libuv
175
171
  callback
176
172
  )
177
173
  end
178
- end
179
-
180
174
 
181
- class Socket6 < SocketBase
175
+ def tcp_bind
176
+ ::Libuv::Ext.tcp_bind(@tcp, @sockaddr)
177
+ end
178
+ end
182
179
 
183
180
 
184
- private
181
+ class Socket4 < SocketBase
182
+ protected
185
183
 
186
184
 
187
185
  def ip_addr(ip, port)
188
- ::Libuv::Ext.ip6_addr(ip, port)
186
+ addr = Ext::SockaddrIn.new
187
+ check_result! ::Libuv::Ext.ip4_addr(ip, port, addr)
188
+ addr
189
189
  end
190
+ end
190
191
 
191
- def tcp_bind
192
- ::Libuv::Ext.tcp_bind6(@tcp, @sockaddr)
193
- end
194
192
 
195
- def tcp_connect(callback)
196
- ::Libuv::Ext.tcp_connect6(
197
- connect_req,
198
- @tcp,
199
- @sockaddr,
200
- callback
201
- )
193
+ class Socket6 < SocketBase
194
+ protected
195
+
196
+
197
+ def ip_addr(ip, port)
198
+ addr = Ext::SockaddrIn6.new
199
+ check_result! ::Libuv::Ext.ip6_addr(ip, port, addr)
200
+ addr
202
201
  end
203
202
  end
204
203
  end
data/lib/libuv/timer.rb CHANGED
@@ -14,6 +14,7 @@ module Libuv
14
14
 
15
15
  timer_ptr = ::Libuv::Ext.create_handle(:uv_timer)
16
16
  error = check_result(::Libuv::Ext.timer_init(loop.handle, timer_ptr))
17
+ @stopped = true
17
18
 
18
19
  super(timer_ptr, error)
19
20
  end
@@ -24,7 +25,8 @@ module Libuv
24
25
  # @param repeat [Fixnum] time in milliseconds between repeated callbacks after the first
25
26
  def start(timeout, repeat = 0)
26
27
  return if @closed
27
-
28
+ @stopped = false
29
+
28
30
  assert_type(Integer, timeout, TIMEOUT_ERROR)
29
31
  assert_type(Integer, repeat, REPEAT_ERROR)
30
32
 
@@ -34,7 +36,8 @@ module Libuv
34
36
 
35
37
  # Disables the timer.
36
38
  def stop
37
- return if @closed
39
+ return if @stopped || @closed
40
+ @stopped = true
38
41
  error = check_result ::Libuv::Ext.timer_stop(handle)
39
42
  reject(error) if error
40
43
  end
data/lib/libuv/udp.rb CHANGED
@@ -19,17 +19,20 @@ module Libuv
19
19
  super(udp_ptr, error)
20
20
  end
21
21
 
22
- def bind(ip, port, ipv6_only = false)
22
+ def bind(ip, port)
23
23
  return if @closed
24
24
  assert_type(String, ip, IP_ARGUMENT_ERROR)
25
25
  assert_type(Integer, port, PORT_ARGUMENT_ERROR)
26
26
 
27
- begin
28
- @udp_socket = create_socket(IPAddr.new(ip), port)
29
- @udp_socket.bind(ipv6_only)
30
- rescue Exception => e
31
- reject(e)
32
- end
27
+ sockaddr = create_sockaddr(ip, port)
28
+ error = check_result ::Libuv::Ext.udp_bind(handle, sockaddr, 0)
29
+ reject(error) if error
30
+ end
31
+
32
+ def open(fd, binding = true, callback = nil, &blk)
33
+ return if @closed
34
+ error = check_result UV.udp_open(handle, fd)
35
+ reject(error) if error
33
36
  end
34
37
 
35
38
  def sockname
@@ -57,13 +60,17 @@ module Libuv
57
60
  reject(error) if error
58
61
  end
59
62
 
60
- def start_recv
63
+ # Starts reading from the handle
64
+ # Renamed to match Stream
65
+ def start_read
61
66
  return if @closed
62
67
  error = check_result ::Libuv::Ext.udp_recv_start(handle, callback(:on_allocate), callback(:on_recv))
63
68
  reject(error) if error
64
69
  end
65
70
 
66
- def stop_recv
71
+ # Stops reading from the handle
72
+ # Renamed to match Stream
73
+ def stop_read
67
74
  return if @closed
68
75
  error = check_result ::Libuv::Ext.udp_recv_stop(handle)
69
76
  reject(error) if error
@@ -78,10 +85,10 @@ module Libuv
78
85
  assert_type(Integer, port, PORT_ARGUMENT_ERROR)
79
86
  assert_type(String, data, SEND_DATA_ERROR)
80
87
 
81
- @udp_socket = create_socket(IPAddr.new(ip), port)
88
+ sockaddr = create_sockaddr(ip, port)
82
89
 
83
90
  # local as this variable will be avaliable until the handle is closed
84
- @sent_callbacks = @sent_callbacks || []
91
+ @sent_callbacks ||= []
85
92
 
86
93
  #
87
94
  # create the curried callback
@@ -97,16 +104,21 @@ module Libuv
97
104
  #
98
105
  # Save the callback and return the promise
99
106
  #
100
- begin
101
- @sent_callbacks << [deferred, callback]
102
- @udp_socket.send(data, callback)
103
- rescue Exception => e
107
+ @sent_callbacks << [deferred, callback]
108
+ error = check_result ::Libuv::Ext.udp_send(
109
+ send_req,
110
+ handle,
111
+ buf_init(data),
112
+ 1,
113
+ sockaddr,
114
+ callback
115
+ )
116
+ if error
104
117
  @sent_callbacks.pop
105
- deferred.reject(e)
106
-
107
- reject(e) # close the handle
118
+ deferred.reject(error)
119
+ reject(error) # close the handle
108
120
  end
109
- rescue Exception => e
121
+ rescue StandardError => e
110
122
  deferred.reject(e)
111
123
  end
112
124
  else
@@ -153,12 +165,39 @@ module Libuv
153
165
  reject(error) if error
154
166
  end
155
167
 
168
+ def progress(callback = nil, &blk)
169
+ @progress = callback || blk
170
+ end
171
+
156
172
 
157
173
  private
158
174
 
159
175
 
160
- def on_allocate(client, suggested_size)
161
- ::Libuv::Ext.buf_init(::Libuv::Ext.malloc(suggested_size), suggested_size)
176
+ def send_req
177
+ ::Libuv::Ext.create_request(:uv_udp_send)
178
+ end
179
+
180
+ def buf_init(data)
181
+ ::Libuv::Ext.buf_init(FFI::MemoryPointer.from_string(data), data.respond_to?(:bytesize) ? data.bytesize : data.size)
182
+ end
183
+
184
+ def create_sockaddr(ip, port)
185
+ ips = IPAddr.new(ip)
186
+ if ips.ipv4?
187
+ addr = Ext::SockaddrIn.new
188
+ check_result! ::Libuv::Ext.ip4_addr(ip, port, addr)
189
+ addr
190
+ else
191
+ addr = Ext::SockaddrIn6.new
192
+ check_result! ::Libuv::Ext.ip6_addr(ip, port, addr)
193
+ addr
194
+ end
195
+ end
196
+
197
+
198
+ def on_allocate(client, suggested_size, buffer)
199
+ buffer[:len] = suggested_size
200
+ buffer[:base] = ::Libuv::Ext.malloc(suggested_size)
162
201
  end
163
202
 
164
203
  def on_recv(handle, nread, buf, sockaddr, flags)
@@ -174,100 +213,12 @@ module Libuv
174
213
  unless sockaddr.null?
175
214
  ip, port = get_ip_and_port(UV::Sockaddr.new(sockaddr))
176
215
  end
177
- defer.notify(data, ip, port) # stream the data
178
- end
179
- end
180
-
181
- def create_socket(ip, port)
182
- if ip.ipv4?
183
- Socket4.new(@loop, handle, ip, port)
184
- else
185
- Socket6.new(@loop, handle, ip, port)
186
- end
187
- end
188
-
189
-
190
- module SocketMethods
191
- include Resource
192
-
193
- def initialize(loop, udp, ip, port)
194
- @loop, @udp, @sockaddr = loop, udp, ip_addr(ip.to_s, port)
195
- end
196
-
197
- def bind(ipv6_only = false)
198
- check_result! udp_bind(ipv6_only)
199
- end
200
-
201
- def send(data, callback)
202
- check_result! udp_send(data, callback)
203
- end
204
-
205
-
206
- private
207
-
208
-
209
- def send_req
210
- ::Libuv::Ext.create_request(:uv_udp_send)
211
- end
212
-
213
- def buf_init(data)
214
- ::Libuv::Ext.buf_init(FFI::MemoryPointer.from_string(data), data.respond_to?(:bytesize) ? data.bytesize : data.size)
215
- end
216
- end
217
-
218
-
219
- class Socket4
220
- include SocketMethods
221
-
222
-
223
- private
224
-
225
-
226
- def ip_addr(ip, port)
227
- ::Libuv::Ext.ip4_addr(ip, port)
228
- end
229
-
230
- def udp_bind(ipv6_only)
231
- ::Libuv::Ext.udp_bind(@udp, @sockaddr, 0)
232
- end
233
-
234
- def udp_send(data, callback)
235
- ::Libuv::Ext.udp_send(
236
- send_req,
237
- @udp,
238
- buf_init(data),
239
- 1,
240
- @sockaddr,
241
- callback
242
- )
243
- end
244
- end
245
-
246
-
247
- class Socket6 < Socket
248
- include SocketMethods
249
-
250
-
251
- private
252
-
253
-
254
- def ip_addr(ip, port)
255
- ::Libuv::Ext.ip6_addr(ip, port)
256
- end
257
-
258
- def udp_bind(ipv6_only)
259
- ::Libuv::Ext.udp_bind6(@udp, @sockaddr, ipv6_only ? 1 : 0)
260
- end
261
-
262
- def udp_send(data, callback)
263
- ::Libuv::Ext.udp_send6(
264
- send_req,
265
- @udp,
266
- buf_init(data),
267
- 1,
268
- @sockaddr,
269
- callback
270
- )
216
+
217
+ begin
218
+ @progress.call data, ip, port, self
219
+ rescue Exception => e
220
+ @loop.log :error, :udp_progress_cb, e
221
+ end
271
222
  end
272
223
  end
273
224
  end
data/lib/libuv/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Libuv
2
- VERSION = '0.10.2'
2
+ VERSION = '0.10.3'
3
3
  end
data/lib/libuv/work.rb CHANGED
@@ -3,6 +3,10 @@ module Libuv
3
3
  include Resource, Listener
4
4
 
5
5
 
6
+ attr_reader :error
7
+ attr_reader :result
8
+
9
+
6
10
  # @param loop [::Libuv::Loop] loop this work request will be associated
7
11
  # @param work [Proc] callback to be called in the thread pool
8
12
  def initialize(loop, work)
@@ -46,16 +50,21 @@ module Libuv
46
50
  @complete = true
47
51
  ::Libuv::Ext.free(req)
48
52
 
49
- if @error
50
- @defer.reject(@error)
53
+ e = check_result(status)
54
+ if e
55
+ @defer.reject(e)
51
56
  else
52
- resolve @defer, status
57
+ if @error
58
+ @defer.reject(@error)
59
+ else
60
+ @defer.resolve(@result)
61
+ end
53
62
  end
54
63
  end
55
64
 
56
65
  def on_work(req)
57
66
  begin
58
- @work.call
67
+ @result = @work.call
59
68
  rescue Exception => e
60
69
  @error = e # Catch errors for promise resolution
61
70
  end
@@ -17,9 +17,9 @@ describe Libuv::Filesystem do
17
17
 
18
18
  @logger = proc { |level, errorid, error|
19
19
  begin
20
- p "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n")}\n"
20
+ @general_failure << "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n")}\n"
21
21
  rescue Exception
22
- p 'error in logger'
22
+ @general_failure << 'error in logger'
23
23
  end
24
24
  }
25
25
 
@@ -106,10 +106,15 @@ describe Libuv::Filesystem do
106
106
  @loop.run { |logger|
107
107
  logger.progress &@logger
108
108
 
109
- @loop.filesystem.unlink(@thefile).then do
109
+ op = @loop.filesystem.unlink(@thefile)
110
+ op.then do
110
111
  @loop.stop
111
112
  @log = :success
112
113
  end
114
+ op.catch do |error|
115
+ @general_failure << error
116
+ @loop.stop
117
+ end
113
118
  }
114
119
 
115
120
  @general_failure.should == []
data/spec/pipe_spec.rb CHANGED
@@ -15,11 +15,11 @@ describe Libuv::Pipe do
15
15
  end
16
16
  @timeout.start(5000)
17
17
 
18
- @pipefile = "/tmp/test-pipe.pipe"
18
+ @pipefile = "/tmp/test-pipes.pipe"
19
19
 
20
20
  @loop.all(@server, @client, @timeout).catch do |reason|
21
21
  @general_failure << reason.inspect
22
- p "Failed with: #{reason.message}\n#{reason.backtrace.join("\n")}\n"
22
+ @general_failure << "Failed with: #{reason.message}\n#{reason.backtrace}\n"
23
23
  end
24
24
 
25
25
  begin
@@ -41,9 +41,9 @@ describe Libuv::Pipe do
41
41
  @loop.run { |logger|
42
42
  logger.progress do |level, errorid, error|
43
43
  begin
44
- p "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n")}\n"
44
+ @general_failure << "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace}\n"
45
45
  rescue Exception
46
- p 'error in logger'
46
+ @general_failure << 'error in logger'
47
47
  end
48
48
  end
49
49
 
@@ -62,7 +62,7 @@ describe Libuv::Pipe do
62
62
  @general_failure << reason.inspect
63
63
  @loop.stop
64
64
 
65
- p "Failed with: #{reason.message}\n#{reason.backtrace.join("\n")}\n"
65
+ @general_failure << "Failed with: #{reason.message}\n#{reason.backtrace}\n"
66
66
  end
67
67
 
68
68
  # start listening
@@ -82,6 +82,13 @@ describe Libuv::Pipe do
82
82
  @client.write('ping')
83
83
  end
84
84
 
85
+ @client.catch do |reason|
86
+ @general_failure << reason.inspect
87
+ @loop.stop
88
+
89
+ @general_failure << "Failed with: #{reason.message}\n#{reason.backtrace}\n"
90
+ end
91
+
85
92
  # Stop the loop once the client handle is closed
86
93
  @client.finally do
87
94
  @server.close
@@ -94,8 +101,8 @@ describe Libuv::Pipe do
94
101
  end
95
102
  end
96
103
 
97
- # This test won't pass on jRuby as java won't expose file descriptors
98
- describe 'unidirectional pipeline' do
104
+ # This test won't pass on windows as pipes don't work like this on windows
105
+ describe 'unidirectional pipeline', :unix_only => true do
99
106
  before :each do
100
107
  system "/usr/bin/mkfifo", @pipefile
101
108
  end
@@ -103,7 +110,7 @@ describe Libuv::Pipe do
103
110
  it "should send work to a consumer" do
104
111
  @loop.run { |logger|
105
112
  logger.progress do |level, errorid, error|
106
- p "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n")}\n"
113
+ @general_failure << "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n")}\n"
107
114
  end
108
115
 
109
116
 
@@ -120,7 +127,7 @@ describe Libuv::Pipe do
120
127
  end
121
128
  end
122
129
  @file1.catch do |e|
123
- p "Log called: #{level}: #{errorid}\n#{e.message}\n#{e.backtrace.join("\n")}\n"
130
+ @general_failure << "Log called: #{e.inspect} - #{e.message}\n"
124
131
  end
125
132
 
126
133
  @file2 = @loop.file(@pipefile, File::RDWR|File::NONBLOCK)
data/spec/tcp_spec.rb CHANGED
@@ -35,9 +35,9 @@ describe Libuv::TCP do
35
35
  @loop.run { |logger|
36
36
  logger.progress do |level, errorid, error|
37
37
  begin
38
- p "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n")}\n"
38
+ @general_failure << "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n")}\n"
39
39
  rescue Exception
40
- p 'error in logger'
40
+ @general_failure << 'error in logger'
41
41
  end
42
42
  end
43
43
 
@@ -98,9 +98,9 @@ describe Libuv::TCP do
98
98
  @loop.run { |logger|
99
99
  logger.progress do |level, errorid, error|
100
100
  begin
101
- p "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n")}\n"
101
+ @general_failure << "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n")}\n"
102
102
  rescue Exception
103
- p 'error in logger'
103
+ @general_failure << 'error in logger'
104
104
  end
105
105
  end
106
106
 
@@ -167,9 +167,9 @@ describe Libuv::TCP do
167
167
  @loop2.run do |logger|
168
168
  logger.progress do |level, errorid, error|
169
169
  begin
170
- p "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n")}\n"
170
+ @general_failure << "Log called: #{level}: #{errorid}\n#{error.message}\n#{error.backtrace.join("\n")}\n"
171
171
  rescue Exception
172
- p 'error in logger'
172
+ @general_failure << 'error in logger'
173
173
  end
174
174
  end
175
175
 
metadata CHANGED
@@ -1,97 +1,86 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libuv
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.10.2
4
+ version: 0.10.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Bulat Shakirzyanov
9
8
  - Stephen von Takach
10
- autorequire:
9
+ autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-09-03 00:00:00.000000000 Z
12
+ date: 2013-11-06 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: ffi
17
- version_requirements: !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
18
17
  requirements:
19
- - - '>='
18
+ - - ">="
20
19
  - !ruby/object:Gem::Version
21
20
  version: '1.9'
22
- none: false
23
- requirement: !ruby/object:Gem::Requirement
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.9'
28
- none: false
29
- prerelease: false
30
- type: :runtime
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: thread_safe
33
- version_requirements: !ruby/object:Gem::Requirement
30
+ requirement: !ruby/object:Gem::Requirement
34
31
  requirements:
35
- - - '>='
32
+ - - ">="
36
33
  - !ruby/object:Gem::Version
37
34
  version: '0'
38
- none: false
39
- requirement: !ruby/object:Gem::Requirement
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
40
38
  requirements:
41
- - - '>='
39
+ - - ">="
42
40
  - !ruby/object:Gem::Version
43
41
  version: '0'
44
- none: false
45
- prerelease: false
46
- type: :runtime
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: rspec
49
- version_requirements: !ruby/object:Gem::Requirement
44
+ requirement: !ruby/object:Gem::Requirement
50
45
  requirements:
51
- - - '>='
46
+ - - ">="
52
47
  - !ruby/object:Gem::Version
53
48
  version: '2.14'
54
- none: false
55
- requirement: !ruby/object:Gem::Requirement
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
56
52
  requirements:
57
- - - '>='
53
+ - - ">="
58
54
  - !ruby/object:Gem::Version
59
55
  version: '2.14'
60
- none: false
61
- prerelease: false
62
- type: :development
63
56
  - !ruby/object:Gem::Dependency
64
57
  name: rake
65
- version_requirements: !ruby/object:Gem::Requirement
58
+ requirement: !ruby/object:Gem::Requirement
66
59
  requirements:
67
- - - '>='
60
+ - - ">="
68
61
  - !ruby/object:Gem::Version
69
62
  version: '10.1'
70
- none: false
71
- requirement: !ruby/object:Gem::Requirement
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
72
66
  requirements:
73
- - - '>='
67
+ - - ">="
74
68
  - !ruby/object:Gem::Version
75
69
  version: '10.1'
76
- none: false
77
- prerelease: false
78
- type: :development
79
70
  - !ruby/object:Gem::Dependency
80
71
  name: yard
81
- version_requirements: !ruby/object:Gem::Requirement
72
+ requirement: !ruby/object:Gem::Requirement
82
73
  requirements:
83
- - - '>='
74
+ - - ">="
84
75
  - !ruby/object:Gem::Version
85
76
  version: '0'
86
- none: false
87
- requirement: !ruby/object:Gem::Requirement
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
88
80
  requirements:
89
- - - '>='
81
+ - - ">="
90
82
  - !ruby/object:Gem::Version
91
83
  version: '0'
92
- none: false
93
- prerelease: false
94
- type: :development
95
84
  description: An opinionated wrapper around libuv for Ruby
96
85
  email:
97
86
  - mallluhuct@gmail.com
@@ -101,10 +90,10 @@ extensions:
101
90
  - ext/Rakefile
102
91
  extra_rdoc_files: []
103
92
  files:
104
- - .gitignore
105
- - .gitmodules
106
- - .rspec
107
- - .travis.yml
93
+ - ".gitignore"
94
+ - ".gitmodules"
95
+ - ".rspec"
96
+ - ".travis.yml"
108
97
  - Gemfile
109
98
  - LICENSE
110
99
  - README.md
@@ -168,7 +157,7 @@ files:
168
157
  - ext/libuv/checksparse.sh
169
158
  - ext/libuv/common.gypi
170
159
  - ext/libuv/configure.ac
171
- - ext/libuv/gyp_uv
160
+ - ext/libuv/gyp_uv.py
172
161
  - ext/libuv/include/pthread-fixes.h
173
162
  - ext/libuv/include/stdint-msvc2008.h
174
163
  - ext/libuv/include/tree.h
@@ -187,6 +176,7 @@ files:
187
176
  - ext/libuv/src/queue.h
188
177
  - ext/libuv/src/unix/aix.c
189
178
  - ext/libuv/src/unix/async.c
179
+ - ext/libuv/src/unix/atomic-ops.h
190
180
  - ext/libuv/src/unix/core.c
191
181
  - ext/libuv/src/unix/darwin-proctitle.c
192
182
  - ext/libuv/src/unix/darwin.c
@@ -211,6 +201,7 @@ files:
211
201
  - ext/libuv/src/unix/proctitle.c
212
202
  - ext/libuv/src/unix/pthread-fixes.c
213
203
  - ext/libuv/src/unix/signal.c
204
+ - ext/libuv/src/unix/spinlock.h
214
205
  - ext/libuv/src/unix/stream.c
215
206
  - ext/libuv/src/unix/sunos.c
216
207
  - ext/libuv/src/unix/tcp.c
@@ -292,6 +283,7 @@ files:
292
283
  - ext/libuv/test/test-barrier.c
293
284
  - ext/libuv/test/test-callback-order.c
294
285
  - ext/libuv/test/test-callback-stack.c
286
+ - ext/libuv/test/test-close-order.c
295
287
  - ext/libuv/test/test-condvar.c
296
288
  - ext/libuv/test/test-connection-fail.c
297
289
  - ext/libuv/test/test-cwd-and-chdir.c
@@ -366,34 +358,32 @@ files:
366
358
  - ext/libuv/test/test-udp-open.c
367
359
  - ext/libuv/test/test-udp-options.c
368
360
  - ext/libuv/test/test-udp-send-and-recv.c
369
- - ext/libuv/test/test-util.c
370
361
  - ext/libuv/test/test-walk-handles.c
371
362
  - ext/libuv/uv.gyp
372
363
  - ext/libuv/vcbuild.bat
373
364
  homepage: https://github.com/cotag/libuv
374
365
  licenses:
375
366
  - MIT
376
- post_install_message:
367
+ metadata: {}
368
+ post_install_message:
377
369
  rdoc_options: []
378
370
  require_paths:
379
371
  - lib
380
372
  required_ruby_version: !ruby/object:Gem::Requirement
381
373
  requirements:
382
- - - '>='
374
+ - - ">="
383
375
  - !ruby/object:Gem::Version
384
376
  version: 1.9.2
385
- none: false
386
377
  required_rubygems_version: !ruby/object:Gem::Requirement
387
378
  requirements:
388
- - - '>='
379
+ - - ">="
389
380
  - !ruby/object:Gem::Version
390
381
  version: '0'
391
- none: false
392
382
  requirements: []
393
- rubyforge_project:
394
- rubygems_version: 1.8.24
395
- signing_key:
396
- specification_version: 3
383
+ rubyforge_project:
384
+ rubygems_version: 2.0.3
385
+ signing_key:
386
+ specification_version: 4
397
387
  summary: libuv bindings for Ruby
398
388
  test_files:
399
389
  - spec/async_spec.rb
@@ -403,4 +393,4 @@ test_files:
403
393
  - spec/idle_spec.rb
404
394
  - spec/pipe_spec.rb
405
395
  - spec/tcp_spec.rb
406
- has_rdoc:
396
+ has_rdoc: