sinatra-rocketio-linda 0.1.0 → 0.1.1

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: 812512212de3611d1f28ecd83f4fdcd024b67a7f
4
- data.tar.gz: f14d82ae57e6a01c4f4475c1e9289b4af8f1f4c3
3
+ metadata.gz: 00ad1eabde4c411c5f3cc5e2face0f8a7447f0d1
4
+ data.tar.gz: c3fd2667f18996af19914b5ac4c80f94d5c9fe9a
5
5
  SHA512:
6
- metadata.gz: 9a0a0ff42aed998a286d8b7c3979ab5eb28f48f48a04ad13ac4e5c2ffbb0d8639869cde89f7ce450bdc1b59d264b7bfdb4a13bd8fbd9c05dd761917a235369b4
7
- data.tar.gz: e160b87c06acbb8f0c2cf7cd625c06e3f98c9f0709b48561a092e7e7b647b0ba4640ab638e43627d8b84750ec68210fd24fb411ab7e79412d0751c3246faaf7c
6
+ metadata.gz: 89508b6b7807fd90c6c98db253af38e7875bcb97b278dc3ab8c1b1b6762741515762d4b4348f03b4139a40ddb92b4454ff47c15e3a25523d6f50fe44aa6aaf42
7
+ data.tar.gz: 7c4807cc17a4c3bbcc6cbcd9fac5e1e5b28b163aaa0e8a97f048d3fd9bea58b51bed79ce49793f1d1ce28343ffed68c63c427546bdcbdc4106588b181056342f
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.1.1 2013-05-31
2
+
3
+ * fix canceling callback on client disconnect
4
+
1
5
  === 0.1.0 2013-05-31
2
6
 
3
7
  * Linda::TupleSpace#cancel
@@ -16,6 +16,10 @@ module Sinatra
16
16
  end
17
17
  end
18
18
 
19
+ def self.callbacks
20
+ @@callbacks ||= Hash.new{|h,k| h[k] = Array.new }
21
+ end
22
+
19
23
  end
20
24
  end
21
25
  end
@@ -60,12 +64,16 @@ end
60
64
  Sinatra::RocketIO::Linda.emit :error, "received Callback ID is not valid at :__linda_#{func}"
61
65
  next
62
66
  end
63
- eid = Sinatra::RocketIO::Linda[space].__send__ func, tuple do |tuple|
67
+ callback_id = Sinatra::RocketIO::Linda[space].__send__ func, tuple do |tuple|
64
68
  Sinatra::RocketIO.push "__linda_#{func}_callback_#{callback}", tuple, :to => client.session
65
69
  Sinatra::RocketIO::Linda.emit func, Hashie::Mash.new(:space => space, :tuple => tuple), client
66
70
  end
67
- Sinatra::RocketIO.on :disconnect do |_client|
68
- Sinatra::RocketIO::Linda[space].cancel eid if client.session == _client.session
69
- end
71
+ Sinatra::RocketIO::Linda.callbacks[client.session].push(:space => space, :callback => callback_id)
72
+ end
73
+ end
74
+
75
+ Sinatra::RocketIO.on :disconnect do |client|
76
+ Sinatra::RocketIO::Linda.callbacks[client.session].each do |i|
77
+ Sinatra::RocketIO::Linda[i[:space]].cancel i[:callback]
70
78
  end
71
79
  end
@@ -1,7 +1,7 @@
1
1
  module Sinatra
2
2
  module RocketIO
3
3
  module Linda
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-rocketio-linda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Hashimoto