cable_room 0.6.2.beta7 → 0.6.2.beta8
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 +4 -4
- data/lib/cable_room/room/port_management.rb +1 -4
- data/lib/cable_room/room_member.rb +20 -3
- data/lib/cable_room/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cf9bc187f61f47429b4f6d19591ae11f9ce5adc4f3e631a386543c5a4be3d31f
|
|
4
|
+
data.tar.gz: 7ea623c7bce5023f7eef8e9f70c7fd723dd6d4c83ffdff6e0e636bcf4a0c2085
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3ea7801344b227a3db243d32aa569427a2e721adb2c4e8894ff803834a6e60392a064cac0b9f2bf21257936109b472d99f994bb82eec3387aa490d1cf7260c1b
|
|
7
|
+
data.tar.gz: b0d7b8b7b054d5a45290df64691e919a9ac8d951beb06df38edf799e3c81bb955ca5444b490293fb4d20d0a09759dc4b8122334d2d041ebf52e6bbd23486d8cf
|
|
@@ -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,13 @@ module CableRoom
|
|
|
51
51
|
|
|
52
52
|
def transmit_subscription_confirmation(...)
|
|
53
53
|
super
|
|
54
|
-
|
|
54
|
+
# Rails invokes this from the pubsub adapter's subscribe success callback, which runs while
|
|
55
|
+
# SubscriberMap holds its (non-reentrant) @sync mutex. Broadcasting from that stack raises
|
|
56
|
+
# ThreadError: deadlock; recursive locking, and the adapter swallows it. Defer onto the event
|
|
57
|
+
# loop so the announce still happens after every stream is confirmed live, but off the lock.
|
|
58
|
+
memberships = _room_memberships.to_a
|
|
59
|
+
memberships.each(&:streams_live!)
|
|
60
|
+
connection.server.event_loop.post { memberships.each(&:transmit_port_connected) }
|
|
55
61
|
end
|
|
56
62
|
end
|
|
57
63
|
|
|
@@ -78,6 +84,7 @@ module CableRoom
|
|
|
78
84
|
|
|
79
85
|
@has_left = false
|
|
80
86
|
@has_established = false
|
|
87
|
+
@streams_live = false
|
|
81
88
|
|
|
82
89
|
@cable_channel = cable_channel
|
|
83
90
|
@room_class = room_class
|
|
@@ -146,6 +153,11 @@ module CableRoom
|
|
|
146
153
|
|
|
147
154
|
def key; @room_key; end
|
|
148
155
|
|
|
156
|
+
# @internal
|
|
157
|
+
def streams_live!
|
|
158
|
+
@streams_live = true
|
|
159
|
+
end
|
|
160
|
+
|
|
149
161
|
# @internal
|
|
150
162
|
def transmit_port_connected
|
|
151
163
|
msg = {
|
|
@@ -196,7 +208,10 @@ module CableRoom
|
|
|
196
208
|
@has_established = true
|
|
197
209
|
@on_joined&.call(self) if first_acknowledgement
|
|
198
210
|
when 'room_opened'
|
|
199
|
-
|
|
211
|
+
# Only safe once our own streams are confirmed; otherwise the room may acknowledge on the
|
|
212
|
+
# private port before anyone is listening. If we are not live yet, the subscription
|
|
213
|
+
# confirmation hook will announce for us.
|
|
214
|
+
transmit_port_connected if @streams_live
|
|
200
215
|
@on_room_opened&.call(self)
|
|
201
216
|
when 'room_closed'
|
|
202
217
|
leave!
|
|
@@ -243,7 +258,9 @@ module CableRoom
|
|
|
243
258
|
|
|
244
259
|
@preconfigure&.call(self)
|
|
245
260
|
|
|
246
|
-
#
|
|
261
|
+
# Announcing here races the async stream subscriptions: the room can acknowledge on the
|
|
262
|
+
# private port before it is live and the ack is lost. transmit_subscription_confirmation
|
|
263
|
+
# announces instead, once every stream is confirmed.
|
|
247
264
|
|
|
248
265
|
maybe_provision_room
|
|
249
266
|
end
|
data/lib/cable_room/version.rb
CHANGED