linda-socket.io-client 0.0.2 → 0.0.3

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: d741bf7229adf24256bfe5324bc159c1d12952d4
4
- data.tar.gz: 186ecdea6c5ba6f92383ddfc0f650cd70fb78561
3
+ metadata.gz: 58a6a89d7ff007812167f158514b009e65c78178
4
+ data.tar.gz: f6c195ca20d5033bfea38854a30a0524d4f0afc6
5
5
  SHA512:
6
- metadata.gz: 039f123acc35ea769fbad3f0cfb7c5ea95f711f3c96a901bf9008496801e1bc16a3efe0fc2ed387ee81783d7e6824c71e36e25dfb125096dc03728dd3d04cddc
7
- data.tar.gz: e08278e32f67cb982f755c53cdd96ece5ac1bda9d6d17eab536744a0c7d63a67f9ccd5445044a2d45ebb36085d4b0e876c943070f51ec50f0eaa35ed5b4261f2
6
+ metadata.gz: 8f8a463651c25509de443a6072bc3ebaff7770d60c7e0e71e71cb3005c8df92dc5b59b703a393a0f2debc70c2888e29f4e52fa4b5562a20f6a18657b2a233683
7
+ data.tar.gz: 896d9db672bb63301d75a38e6b37104fd8fec8ad72cae44d56ce60e75e225638af1a02dd6ac7f302e7b5e2ec1f94e47eff66d425b78d700cdda8506834082874
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- linda-socket.io-client (0.0.2)
4
+ linda-socket.io-client (0.0.3)
5
5
  event_emitter
6
6
  hashie
7
7
  json
@@ -1,3 +1,7 @@
1
+ === 0.0.3 2014-1-24
2
+
3
+ * remove Socket.IO callbacks on IO closed #3
4
+
1
5
  === 0.0.2 2014-1-24
2
6
 
3
7
  * wrap return value of TupleSpace#read/take/watch by Hashie::Mash #2
@@ -39,6 +39,27 @@ module Linda
39
39
  @name = name
40
40
  @linda = linda
41
41
  @watch_callback_ids = {}
42
+ @io_callback_ids = []
43
+ this = self
44
+ @linda.io.on 'disconnect' do
45
+ this.remove_io_callbacks
46
+ end
47
+ end
48
+
49
+ def create_callback_id
50
+ "#{Time.now.to_i}_#{rand 10000}"
51
+ end
52
+
53
+ def create_watch_callback_id(tuple)
54
+ key = tuple.to_json
55
+ return @watch_callback_ids[key] ||= create_callback_id
56
+ end
57
+
58
+ def remove_io_callbacks
59
+ @io_callback_ids.each do |id|
60
+ @linda.io.remove_listener id
61
+ end
62
+ @io_callback_ids = []
42
63
  end
43
64
 
44
65
  def write(tuple, opts={})
@@ -53,6 +74,7 @@ module Linda
53
74
  io_cid = @linda.io.once name do |err, tuple|
54
75
  block.call err, Tuple.new(tuple)
55
76
  end
77
+ @io_callback_ids.push io_cid
56
78
  @linda.io.emit '__linda_take', {:tuplespace => @name, :tuple => tuple, :id => id}
57
79
  return id
58
80
  end
@@ -64,6 +86,7 @@ module Linda
64
86
  io_cid = @linda.io.once name do |err, tuple|
65
87
  block.call err, Tuple.new(tuple)
66
88
  end
89
+ @io_callback_ids.push io_cid
67
90
  @linda.io.emit '__linda_read', {:tuplespace => @name, :tuple => tuple, :id => id}
68
91
  return id
69
92
  end
@@ -75,6 +98,7 @@ module Linda
75
98
  io_cid = @linda.io.on name do |err, tuple|
76
99
  block.call err, Tuple.new(tuple)
77
100
  end
101
+ @io_callback_ids.push io_cid
78
102
  @linda.io.emit '__linda_watch', {:tuplespace => @name, :tuple => tuple, :id => id}
79
103
  return id
80
104
  end
@@ -83,16 +107,6 @@ module Linda
83
107
  @linda.io.emit '__linda_cancel', {:tuplespace => @name, :id => id}
84
108
  end
85
109
 
86
- private
87
- def create_callback_id
88
- "#{Time.now.to_i}_#{rand 10000}"
89
- end
90
-
91
- def create_watch_callback_id(tuple)
92
- key = tuple.to_json
93
- return @watch_callback_ids[key] ||= create_callback_id
94
- end
95
-
96
110
  end
97
111
 
98
112
  end
@@ -1,7 +1,7 @@
1
1
  module Linda
2
2
  module SocketIO
3
3
  module Client
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
6
6
  end
7
7
  end
@@ -7,7 +7,7 @@
7
7
  "homepage": "https://github.com/node-linda/linda-socket.io-client-ruby",
8
8
  "dependencies": {
9
9
  "socket.io": "~0.9.16",
10
- "linda-socket.io": "~0.1.5",
10
+ "linda-socket.io": "~0.2.0",
11
11
  "coffee-script": "~1.6.3"
12
12
  },
13
13
  "devDependencies": {},
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linda-socket.io-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Hashimoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-23 00:00:00.000000000 Z
11
+ date: 2014-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler