lib/tamashii/manager/client_manager.rb in tamashii-manager-0.2.1 vs lib/tamashii/manager/client_manager.rb in tamashii-manager-0.2.2
- old
+ new
@@ -7,20 +7,24 @@
# rubocop:disable Metrics/MethodLength
def self.included(other)
other.class_eval do
class << self
def accepted_clients
- @accepted_clients ||= {}
+ @accepted_clients ||= Concurrent::Hash.new
end
def [](name)
accepted_clients[name.to_s]
end
# TODO: Fix duplicate name
def []=(name, client)
return unless client.is_a?(Client)
accepted_clients[name.to_s] = client
+ end
+
+ def remove_client(name)
+ accepted_clients.delete(name)
end
def send_to(id, packet)
Manager.server.pubsub.send_to(id, packet)
end