cable_room 0.6.2.beta7 → 0.6.2.beta9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7309c58f5b1c28f703935326e40e13194a1e57c57ddd184cfa100ee7c23351d1
4
- data.tar.gz: d666029a14ac41eb3b422edc7de2eaf1ce2cef8c95854f4116052c5bff8b447f
3
+ metadata.gz: 5a0b89cf59e8dc6fa9ebfed2efe728c0c2916bbac6d54738612944adec072762
4
+ data.tar.gz: 55db8ebfde7f3574755f8348e90a4986c8943600c9231b1ce0af723f94863f33
5
5
  SHA512:
6
- metadata.gz: d252055f0b2e4062f01865a6f1ba482e555e3c8325eac88d29b0e0d34673aafccdab72fea916fda0fb6b36dbab4f8e7340ad120d90b463752d79d5c071dc9468
7
- data.tar.gz: 2352b8d4315b7d3fff5389e6c6c9783b3314329cef0233500fd6a26fb91c8343f2244094ce0faa4a1b28f5e0868cef2932a27364ecfe2c9d7cfb66bb5377a2f4
6
+ metadata.gz: 60f838c24cc7b4bc43541c0cc9386f6a295824b0a44526a1fa0d018240966dc6c81665faed13edc76a7ae7fa4d0ab958dbe0c2486b85fc81f502e3fc819dafe2
7
+ data.tar.gz: 61c0ea11ca13892247ac210fe32cc2c1d5ee157f1da7125f4a9fdde22bee7e9d70a6468e539a7e4503814feefbcbdd80b2e2075291b4b48fd9cd8183e89d6415
@@ -118,10 +118,7 @@ module CableRoom
118
118
  def handle_received_message(message)
119
119
  case message['type']
120
120
  when 'port_connected'
121
- mo = @_port_clients[@current_message_origin]
122
- return if mo
123
-
124
- mo = @_port_clients[@current_message_origin] = PortClient.new(self, @current_message_origin)
121
+ mo = @_port_clients[@current_message_origin] ||= PortClient.new(self, @current_message_origin)
125
122
 
126
123
  mo.touch_activity!
127
124
  mo.tag!(message['tags'])
@@ -51,7 +51,11 @@ module CableRoom
51
51
 
52
52
  def transmit_subscription_confirmation(...)
53
53
  super
54
- _room_memberships.each(&:transmit_port_connected)
54
+ memberships = _room_memberships.to_a
55
+ memberships.each(&:streams_live!)
56
+ connection.worker_pool.async_exec(self, connection: connection) do
57
+ memberships.each(&:transmit_port_connected)
58
+ end
55
59
  end
56
60
  end
57
61
 
@@ -78,6 +82,7 @@ module CableRoom
78
82
 
79
83
  @has_left = false
80
84
  @has_established = false
85
+ @streams_live = false
81
86
 
82
87
  @cable_channel = cable_channel
83
88
  @room_class = room_class
@@ -146,6 +151,11 @@ module CableRoom
146
151
 
147
152
  def key; @room_key; end
148
153
 
154
+ # @internal
155
+ def streams_live!
156
+ @streams_live = true
157
+ end
158
+
149
159
  # @internal
150
160
  def transmit_port_connected
151
161
  msg = {
@@ -196,7 +206,10 @@ module CableRoom
196
206
  @has_established = true
197
207
  @on_joined&.call(self) if first_acknowledgement
198
208
  when 'room_opened'
199
- transmit_port_connected
209
+ # Only safe once our own streams are confirmed; otherwise the room may acknowledge on the
210
+ # private port before anyone is listening. If we are not live yet, the subscription
211
+ # confirmation hook will announce for us.
212
+ transmit_port_connected if @streams_live
200
213
  @on_room_opened&.call(self)
201
214
  when 'room_closed'
202
215
  leave!
@@ -243,7 +256,9 @@ module CableRoom
243
256
 
244
257
  @preconfigure&.call(self)
245
258
 
246
- # transmit_port_connected
259
+ # Announcing here races the async stream subscriptions: the room can acknowledge on the
260
+ # private port before it is live and the ack is lost. transmit_subscription_confirmation
261
+ # announces instead, once every stream is confirmed.
247
262
 
248
263
  maybe_provision_room
249
264
  end
@@ -1,3 +1,3 @@
1
1
  module CableRoom
2
- VERSION = "0.6.2.beta7".freeze
2
+ VERSION = "0.6.2.beta9".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cable_room
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2.beta7
4
+ version: 0.6.2.beta9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan Knapp