cable_room 0.4.0 → 0.4.3
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aec4300c2501be5b03552fb3ee2aa096dfeeae41203f85ad1d9715084f209e2e
|
|
4
|
+
data.tar.gz: 13b6d7062eb049b8235948d80fc121defffd571054cbaf64403ca5adda0c77b4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 58db3c0ae21e9844c810c124241911dcf4414ca068b90f72f7fb9bb734ba3a301f59ae6d73efc787d01144b023fcb6b69aa0ffc842f889a5306349dbab1b8b76
|
|
7
|
+
data.tar.gz: b2fd75650ced68cbb4e071e77e9d81e2f2fa61502d8164eda4f9a0bfaa5360471f4ed2ae0a4840be40aa6a4cd9c8ef53759b3198021fa7eb105c7740c22e1294
|
|
@@ -3,9 +3,6 @@ module CableRoom
|
|
|
3
3
|
module PortManagement
|
|
4
4
|
extend ActiveSupport::Concern
|
|
5
5
|
|
|
6
|
-
require_relative 'port_policies'
|
|
7
|
-
include PortPolicies
|
|
8
|
-
|
|
9
6
|
PORT_TIMEOUT = 30.seconds
|
|
10
7
|
|
|
11
8
|
class_methods do
|
|
@@ -38,6 +35,9 @@ module CableRoom
|
|
|
38
35
|
@current_message_origin = previous_mtok
|
|
39
36
|
end
|
|
40
37
|
end
|
|
38
|
+
|
|
39
|
+
require_relative 'port_policies'
|
|
40
|
+
include PortPolicies
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def initialize(...)
|
|
@@ -94,13 +94,13 @@ module CableRoom
|
|
|
94
94
|
def handle_received_message(message)
|
|
95
95
|
case message['type']
|
|
96
96
|
when 'port_connected'
|
|
97
|
-
|
|
97
|
+
mo = @_port_clients[@current_message_origin] ||= PortClient.new(@current_message_origin)
|
|
98
98
|
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
mo.touch_activity!
|
|
100
|
+
mo.tag!(message['tags'])
|
|
101
101
|
|
|
102
102
|
if policy_allows?(message['type'].to_sym)
|
|
103
|
-
|
|
103
|
+
mo.merge!(::ActiveJob::Arguments.deserialize(message['extra'])[0])
|
|
104
104
|
|
|
105
105
|
run_callbacks :port_connected do
|
|
106
106
|
on_port_connected
|
|
@@ -16,7 +16,7 @@ module CableRoom
|
|
|
16
16
|
state = states[cfg] ||= {}
|
|
17
17
|
state[:timer] = start_periodic_timer(->{
|
|
18
18
|
if instance_exec(&cfg[:block])
|
|
19
|
-
shutdown!
|
|
19
|
+
shutdown!("Reaped by #{cfg[:key] || 'anonymous'} reaper")
|
|
20
20
|
else
|
|
21
21
|
ping_watchdog
|
|
22
22
|
end
|
|
@@ -67,7 +67,7 @@ module CableRoom
|
|
|
67
67
|
return if reaper_config.empty?
|
|
68
68
|
|
|
69
69
|
if reaper_config.any? { |cfg| instance_exec(&cfg[:block]) }
|
|
70
|
-
shutdown!
|
|
70
|
+
shutdown!("Reaped by manual check")
|
|
71
71
|
return
|
|
72
72
|
end
|
|
73
73
|
|
|
@@ -14,14 +14,14 @@ module CableRoom
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
included do
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
on_port_connected :_handle_user_setup_during_connection
|
|
18
|
+
on_port_disconnected :_handle_user_cleanup_after_disconnection
|
|
19
19
|
|
|
20
20
|
define_callbacks :user_joined, :user_left
|
|
21
21
|
|
|
22
22
|
self::PortClient.class_eval do
|
|
23
23
|
def user
|
|
24
|
-
@metadata[:
|
|
24
|
+
@metadata[:as]
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
data/lib/cable_room/version.rb
CHANGED