ione 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 166255b7792cfb6e2692c28ecd819874eecec4b5
4
- data.tar.gz: c12c7574df507268a02c86b87924a9d7bea0c405
3
+ metadata.gz: db1f327275f2a707826e35fe337e9244e24579d3
4
+ data.tar.gz: 49634515f2915a2d148fc9bd7261d3995a9c9624
5
5
  SHA512:
6
- metadata.gz: 3a6252fe2dcd04eda59a758bcf3959068bc466cab12d8794f04f95a91db2a8c6f76bbf8f38003459082be7a36ed708283a20281974c6a439b21f51dac08c22ec
7
- data.tar.gz: 1ed5e64c259493d2321aebd7298da66a5b02952740942c9aa5b5edfe65596def5777443700d5ce2e0c4142cb8bd42007afff280f84a5673f5c7f9a283f9ee57f
6
+ metadata.gz: 5573efe1dab6a07649012f63b02dd160023033ba674cb582050d57aaeef4a98cbd00d43651d6d732c3e2d98e32b2cdf838a678836904b9066cf4bb9fda22d806
7
+ data.tar.gz: 8a0b37f8dde7c69f1f05a4bed764c2c3cb5acdd2460fed882d71dd4bc0c1155983e07a2cf2c2ee76510eff1afd8b4f8496a310b308c7838bf411df4a99b0d4ac
@@ -293,13 +293,21 @@ module Ione
293
293
  end
294
294
 
295
295
  def cancel_timer(timer_future)
296
+ timer = nil
296
297
  @lock.lock
297
- timer_pair = @timers.find { |pair| (p = pair[1]) && p.future == timer_future }
298
- @timers = @timers.reject { |pair| pair[1].nil? || pair == timer_pair }
299
- timer_pair && timer_pair[1].fail(CancelledError.new)
298
+ begin
299
+ if (timer_pair = @timers.find { |pair| (p = pair[1]) && p.future == timer_future })
300
+ @timers = @timers.reject { |pair| pair[1].nil? || pair == timer_pair }
301
+ timer = timer_pair[1]
302
+ timer_pair[1] = nil
303
+ end
304
+ ensure
305
+ @lock.unlock
306
+ end
307
+ if timer
308
+ timer.fail(CancelledError.new)
309
+ end
300
310
  nil
301
- ensure
302
- @lock.unlock
303
311
  end
304
312
 
305
313
  def close_sockets
@@ -348,11 +356,18 @@ module Ione
348
356
  end
349
357
 
350
358
  def check_timers!
351
- timers = @timers
352
- timers.each do |pair|
353
- if pair[1] && pair[0] <= @clock.now
354
- pair[1].fulfill
355
- pair[1] = nil
359
+ now = @clock.now
360
+ @timers.each do |pair|
361
+ if pair[1] && pair[0] <= now
362
+ timer = nil
363
+ @lock.lock
364
+ begin
365
+ timer = pair[1]
366
+ pair[1] = nil
367
+ ensure
368
+ @lock.unlock
369
+ end
370
+ timer.fulfill
356
371
  end
357
372
  end
358
373
  end
data/lib/ione/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Ione
4
- VERSION = '1.1.4'.freeze
4
+ VERSION = '1.1.5'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ione
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Theo Hultberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-15 00:00:00.000000000 Z
11
+ date: 2014-10-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Reactive programming framework for Ruby, painless evented IO, futures
14
14
  and an efficient byte buffer