From 342635e967db04d9c0159277ae423cb4080a0de8 Mon Sep 17 00:00:00 2001 From: "G. Gibson" Date: Mon, 1 Sep 2025 19:04:45 -0700 Subject: [PATCH] more fedi tweaks --- Services/www/www.rb | 13 ++++++++++++- Services/www/www/gxg-www.rb | 13 +++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Services/www/www.rb b/Services/www/www.rb index b882fc9..ac84684 100644 --- a/Services/www/www.rb +++ b/Services/www/www.rb @@ -257,7 +257,7 @@ class WebSocketListener the_display = the_socket.instance_variable_get(:@display) # if the_display - the_manifest = GxG::SERVICES[:www][:manifests][(the_session)] + the_manifest = GxG::SERVICES[:www][:manifests][(the_session['session_id'])] if the_manifest if the_manifest.display_exist?(the_display) the_manifest.display_set(the_display, :available) @@ -271,6 +271,17 @@ class WebSocketListener GxGwww::SOCKETS_SAFETY.synchronize { GxGwww::SOCKETS.delete(the_uuid) } + prune_list = [] + ::GxG::GXG_FEDERATION_SAFETY.synchronize { + ::GxG::GXG_FEDERATION[:connections].each_pair do |uuid, the_channel| + if the_socket == the_channel.socket + prune_list << uuid + end + end + } + prune_list.each do |uuid| + ::GxG::CHANNELS.destroy_channel(uuid) + end puts "Closing Socket #{the_uuid} & Display #{the_display}" true end diff --git a/Services/www/www/gxg-www.rb b/Services/www/www/gxg-www.rb index e0c3500..d1cf1f5 100644 --- a/Services/www/www/gxg-www.rb +++ b/Services/www/www/gxg-www.rb @@ -943,6 +943,7 @@ module GxGwww else raise Exception, "Channel #{the_uuid.to_s.to_sym.inspect} Not Found." end + else raise Exception, "Connector Not Found." end @@ -974,6 +975,9 @@ module GxGwww unless ::GxG::valid_uuid?(remote_uuid.to_s) raise "Invalid Remote ID." end + # Federation + the_channel = ::GxG::CHANNELS.create_channel(remote_uuid) + # ??? # xxx unless the_display # Expire old Displays and set to :available @@ -1344,6 +1348,15 @@ module GxGwww # Callable Toolbox def set_socket_uuid(the_uuid) @socket = the_uuid + socket_channel = ::GxG::CHANNELS.fetch_channel(@socket.to_s.to_sym) + display_channel = ::GxG::CHANNELS.fetch_channel(@remote_uuid.to_s.to_sym) + if socket_channel && display_channel + display_channel.socket = socket_channel.socket + display_channel.secret = socket_channel.secret + else + raise Exception.new("Failed to bind display and socket") + end + true end # def admin_get_roles()