From d4144bedb81346301162f1e20266561fea7b621e Mon Sep 17 00:00:00 2001 From: Jonathan Freedman Date: Thu, 21 Oct 2010 23:22:15 -0400 Subject: * change the data exchanged within hypergrid transactions --- .../Region/ClientStack/LindenUDP/LLUDPServer.cs | 2 +- .../EntityTransfer/EntityTransferModule.cs | 8 +-- .../EntityTransfer/HGEntityTransferModule.cs | 5 +- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- .../Server/Handlers/Hypergrid/HomeAgentHandlers.cs | 10 ++- .../Hypergrid/GatekeeperServiceConnector.cs | 35 ++++++----- .../Hypergrid/UserAgentServiceConnector.cs | 2 + OpenSim/Services/GridService/HypergridLinker.cs | 73 +++++++++++++++++----- .../Services/HypergridService/UserAgentService.cs | 10 ++- 10 files changed, 108 insertions(+), 44 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index cb298fd..624814a 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -631,7 +631,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP IClientAPI client; if (!m_scene.TryGetClient(address, out client) || !(client is LLClientView)) { - //m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); + m_log.Debug("[LLUDPSERVER]: Received a " + packet.Type + " packet from an unrecognized source: " + address + " in " + m_scene.RegionInfo.RegionName); return; } diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 54cc80f..925af3f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -197,8 +197,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer sp.ControllingClient.SendTeleportFailed("Problem at destination"); return; } - m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} uuid={2}", - finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID); + m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Final destination is x={0} y={1} {2}@{3}", + finalDestination.RegionLocX / Constants.RegionSize, finalDestination.RegionLocY / Constants.RegionSize, finalDestination.RegionID, finalDestination.ServerURI); // Check that these are not the same coordinates if (finalDestination.RegionLocX == sp.Scene.RegionInfo.RegionLocX && @@ -254,8 +254,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } m_log.DebugFormat( - "[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}:{2}/{3}", - reg.ExternalHostName, reg.HttpPort, finalDestination.RegionName, position); + "[ENTITY TRANSFER MODULE]: Request Teleport to {0} ({1}) {2}/{3}", + reg.ServerURI, finalDestination.ServerURI, finalDestination.RegionName, position); uint newRegionX = (uint)(reg.RegionHandle >> 40); uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 1ac7508..9a275ae 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -123,7 +123,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if ((flags & (int)OpenSim.Data.RegionFlags.Hyperlink) != 0) { m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Destination region {0} is hyperlink", region.RegionID); - return m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); + GridRegion real_destination = m_GatekeeperConnector.GetHyperlinkRegion(region, region.RegionID); + m_log.Debug("GetfinalDestination serveruri -> " + real_destination.ServerURI); + return real_destination; } return region; } @@ -149,6 +151,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) { + m_log.Debug("CreateAgent " + reg.ServerURI + " " + finalDestination.ServerURI); reason = string.Empty; logout = false; int flags = m_aScene.GridService.GetRegionFlags(m_aScene.RegionInfo.ScopeID, reg.RegionID); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0cfc235..2750168 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3740,9 +3740,12 @@ namespace OpenSim.Region.Framework.Scenes // We have to wait until the viewer contacts this region after receiving EAC. // That calls AddNewClient, which finally creates the ScenePresence + m_log.Debug("ICADU -> pre wait"); ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); + m_log.Debug("ICADU -> post wait"); if (childAgentUpdate != null) { + m_log.Debug("ICADU -> not child agent!"); childAgentUpdate.ChildAgentDataUpdate(cAgentData); return true; } @@ -3758,7 +3761,7 @@ namespace OpenSim.Region.Framework.Scenes /// true if we handled it. public virtual bool IncomingChildAgentDataUpdate(AgentPosition cAgentData) { - //m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); + m_log.Debug(" XXX Scene IncomingChildAgentDataUpdate POSITION in " + RegionInfo.RegionName); ScenePresence childAgentUpdate = GetScenePresence(cAgentData.AgentID); if (childAgentUpdate != null) { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c223b4b..68ac178 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2925,7 +2925,7 @@ namespace OpenSim.Region.Framework.Scenes public void ChildAgentDataUpdate(AgentData cAgentData) { - //m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName); + m_log.Debug(" >>> ChildAgentDataUpdate <<< " + Scene.RegionInfo.RegionName); if (!IsChildAgent) return; diff --git a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs index a1bcba6..a5ec4f2 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HomeAgentHandlers.cs @@ -124,7 +124,8 @@ namespace OpenSim.Server.Handlers.Hypergrid UUID uuid = UUID.Zero; string regionname = string.Empty; string gatekeeper_host = string.Empty; - string server_uri = string.Empty; + string gatekeeper_serveruri = string.Empty; + string destination_serveruri = string.Empty; int gatekeeper_port = 0; IPEndPoint client_ipaddress = null; @@ -132,8 +133,13 @@ namespace OpenSim.Server.Handlers.Hypergrid gatekeeper_host = args["gatekeeper_host"].AsString(); if (args.ContainsKey("gatekeeper_port") && args["gatekeeper_port"] != null) Int32.TryParse(args["gatekeeper_port"].AsString(), out gatekeeper_port); + if (args.ContainsKey("gatekeeper_serveruri") && args["gatekeeper_serveruri"] !=null) + gatekeeper_serveruri = args["gatekeeper_serveruri"]; + if (args.ContainsKey("destination_serveruri") && args["destination_serveruri"] !=null) + destination_serveruri = args["destination_serveruri"]; GridRegion gatekeeper = new GridRegion(); + gatekeeper.ServerURI = gatekeeper_serveruri; gatekeeper.ExternalHostName = gatekeeper_host; gatekeeper.HttpPort = (uint)gatekeeper_port; gatekeeper.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0); @@ -174,8 +180,8 @@ namespace OpenSim.Server.Handlers.Hypergrid destination.RegionLocX = x; destination.RegionLocY = y; destination.RegionName = regionname; + destination.ServerURI = destination_serveruri; - AgentCircuitData aCircuit = new AgentCircuitData(); try { diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index 4231be1..70bafda 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs @@ -116,19 +116,19 @@ namespace OpenSim.Services.Connectors.Hypergrid if (success) { UUID.TryParse((string)hash["uuid"], out regionID); - //m_log.Debug(">> HERE, uuid: " + regionID); + m_log.Debug(">> HERE, uuid: " + regionID); if ((string)hash["handle"] != null) { realHandle = Convert.ToUInt64((string)hash["handle"]); - //m_log.Debug(">> HERE, realHandle: " + realHandle); + m_log.Debug(">> HERE, realHandle: " + realHandle); } if (hash["region_image"] != null) { imageURL = (string)hash["region_image"]; - //m_log.Debug(">> HERE, imageURL: " + imageURL); + m_log.Debug(">> HERE, imageURL: " + imageURL); } if (hash["external_name"] != null) { externalName = (string)hash["external_name"]; - //m_log.Debug(">> HERE, externalName: " + externalName); + m_log.Debug(">> HERE, externalName: " + externalName); } } @@ -191,7 +191,7 @@ namespace OpenSim.Services.Connectors.Hypergrid paramList.Add(hash); XmlRpcRequest request = new XmlRpcRequest("get_region", paramList); - //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: contacting " + gatekeeper.ServerURI); XmlRpcResponse response = null; try { @@ -199,7 +199,7 @@ namespace OpenSim.Services.Connectors.Hypergrid } catch (Exception e) { - //m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); + m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Exception " + e.Message); return null; } @@ -221,41 +221,48 @@ namespace OpenSim.Services.Connectors.Hypergrid GridRegion region = new GridRegion(); UUID.TryParse((string)hash["uuid"], out region.RegionID); - //m_log.Debug(">> HERE, uuid: " + region.RegionID); + m_log.Debug(">> HERE, uuid: " + region.RegionID); int n = 0; if (hash["x"] != null) { Int32.TryParse((string)hash["x"], out n); region.RegionLocX = n; - //m_log.Debug(">> HERE, x: " + region.RegionLocX); + m_log.Debug(">> HERE, x: " + region.RegionLocX); } if (hash["y"] != null) { Int32.TryParse((string)hash["y"], out n); region.RegionLocY = n; - //m_log.Debug(">> HERE, y: " + region.RegionLocY); + m_log.Debug(">> HERE, y: " + region.RegionLocY); } if (hash["region_name"] != null) { region.RegionName = (string)hash["region_name"]; - //m_log.Debug(">> HERE, region_name: " + region.RegionName); + m_log.Debug(">> HERE, region_name: " + region.RegionName); } - if (hash["hostname"] != null) + if (hash["hostname"] != null) { region.ExternalHostName = (string)hash["hostname"]; - //m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); + m_log.Debug(">> HERE, hostname: " + region.ExternalHostName); + } if (hash["http_port"] != null) { uint p = 0; UInt32.TryParse((string)hash["http_port"], out p); region.HttpPort = p; - //m_log.Debug(">> HERE, http_port: " + region.HttpPort); + m_log.Debug(">> HERE, http_port: " + region.HttpPort); } if (hash["internal_port"] != null) { int p = 0; Int32.TryParse((string)hash["internal_port"], out p); region.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), p); - //m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); + m_log.Debug(">> HERE, internal_port: " + region.InternalEndPoint); + } + + if (hash["server_uri"] != null) + { + region.ServerURI = (string) hash["server_uri"]; + m_log.Debug(">> HERE, server_uri: " + region.ServerURI); } // Successful return diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 247dd7e..0c41935 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -232,12 +232,14 @@ namespace OpenSim.Services.Connectors.Hypergrid m_log.Debug("[USER AGENT CONNECTOR]: PackAgentCircuitData failed with exception: " + e.Message); } // Add the input arguments + args["gatekeeper_serveruri"] = OSD.FromString(gatekeeper.ServerURI); args["gatekeeper_host"] = OSD.FromString(gatekeeper.ExternalHostName); args["gatekeeper_port"] = OSD.FromString(gatekeeper.HttpPort.ToString()); args["destination_x"] = OSD.FromString(destination.RegionLocX.ToString()); args["destination_y"] = OSD.FromString(destination.RegionLocY.ToString()); args["destination_name"] = OSD.FromString(destination.RegionName); args["destination_uuid"] = OSD.FromString(destination.RegionID.ToString()); + args["destination_serveruri"] = OSD.FromString(destination.ServerURI); // 10/3/2010 // I added the client_ip up to the regular AgentCircuitData, so this doesn't need to be here. diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 74e864b..c273d21 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs @@ -126,11 +126,12 @@ namespace OpenSim.Services.GridService if (MainConsole.Instance != null) { - MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", - "link-region [] ", - "Link a hypergrid region", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", "link-region []", "Link a HyperGrid Region", RunCommand); + MainConsole.Instance.Commands.AddCommand("hypergrid", false, "legacy-link-region", + "legacy-link-region []", + "Link a hypergrid region (deprecated)", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region", - "unlink-region or : ", + "unlink-region ", "Unlink a hypergrid region", RunCommand); MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-mapping", "link-mapping [ ] ", "Set local coordinate to map HG regions to", RunCommand); @@ -198,27 +199,33 @@ namespace OpenSim.Services.GridService return null; } + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) { + return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); + } + + public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason) + { m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); reason = string.Empty; regInfo = new GridRegion(); - regInfo.RegionName = externalRegionName; - regInfo.HttpPort = externalPort; - regInfo.ExternalHostName = externalHostName; + if ( externalPort > 0) + regInfo.HttpPort = externalPort; + else + regInfo.HttpPort = 0; + if ( externalHostName != null) + regInfo.ExternalHostName = externalHostName; + else + regInfo.ExternalHostName = "0.0.0.0"; + if ( serverURI != null) + regInfo.ServerURI = serverURI; + regInfo.RegionLocX = xloc; regInfo.RegionLocY = yloc; regInfo.ScopeID = scopeID; - // Big HACK for Simian Grid !!! - // We need to clean up all URLs used in OpenSim !!! - if (externalHostName.Contains("/")) { - regInfo.ServerURI = externalHostName; - } else { - regInfo.ServerURI = "http://" + externalHostName + ":" + externalPort.ToString(); - } - try { regInfo.InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)0); @@ -249,9 +256,14 @@ namespace OpenSim.Services.GridService } regInfo.RegionID = regionID; - if (regInfo.RegionName == string.Empty) - regInfo.RegionName = regInfo.ExternalHostName; + if ( externalName == string.Empty ) + regInfo.RegionName = regInfo.ServerURI; + else + regInfo.RegionName = externalName; + + m_log.Debug("naming linked region " + regInfo.RegionName); + // Try get the map image //regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); // I need a texture that works for this... the one I tried doesn't seem to be working @@ -433,6 +445,21 @@ namespace OpenSim.Services.GridService RunHGCommand(command, cmdparams); } + + private void RunLinkRegionCommand(string[] cmdparams) + { + int xloc, yloc; + string serverURI; + string remoteName = null; + xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize; + yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize; + serverURI = cmdparams[2]; + if (cmdparams.Length == 4) + remoteName = cmdparams[3]; + string reason = string.Empty; + GridRegion regInfo; + TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, out regInfo, out reason); + } private void RunHGCommand(string command, string[] cmdparams) { @@ -456,6 +483,18 @@ namespace OpenSim.Services.GridService } else if (command.Equals("link-region")) { + if (cmdparams.Length > 0 && cmdparams.Length < 5) + { + RunLinkRegionCommand(cmdparams); + } + else + { + LinkRegionCmdUsage(); + } + return; + } + else if (command.Equals("legacy-link-region")) + { if (cmdparams.Length < 3) { if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) diff --git a/OpenSim/Services/HypergridService/UserAgentService.cs b/OpenSim/Services/HypergridService/UserAgentService.cs index aed2dc8..eb19fe2 100644 --- a/OpenSim/Services/HypergridService/UserAgentService.cs +++ b/OpenSim/Services/HypergridService/UserAgentService.cs @@ -134,12 +134,14 @@ namespace OpenSim.Services.HypergridService public bool LoginAgentToGrid(AgentCircuitData agentCircuit, GridRegion gatekeeper, GridRegion finalDestination, IPEndPoint clientIP, out string reason) { m_log.DebugFormat("[USER AGENT SERVICE]: Request to login user {0} {1} (@{2}) to grid {3}", - agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), - gatekeeper.ExternalHostName +":"+ gatekeeper.HttpPort); - m_log.Debug("gatekeeper serveruri -> " + gatekeeper.ServerURI ); + agentCircuit.firstname, agentCircuit.lastname, ((clientIP == null) ? "stored IP" : clientIP.Address.ToString()), gatekeeper.ServerURI); + m_log.Debug("LATG final server uri -> " + finalDestination.ServerURI ); // Take the IP address + port of the gatekeeper (reg) plus the info of finalDestination GridRegion region = new GridRegion(gatekeeper); + region.ServerURI = gatekeeper.ServerURI; + region.ExternalHostName = finalDestination.ExternalHostName; + region.InternalEndPoint = finalDestination.InternalEndPoint; region.RegionName = finalDestination.RegionName; region.RegionID = finalDestination.RegionID; region.RegionLocX = finalDestination.RegionLocX; @@ -149,6 +151,8 @@ namespace OpenSim.Services.HypergridService agentCircuit.ServiceSessionID = region.ServerURI + ";" + UUID.Random(); TravelingAgentInfo old = UpdateTravelInfo(agentCircuit, region); + m_log.Debug("region ServerURI -> " + region.ServerURI); + bool success = false; string myExternalIP = string.Empty; string gridName = gatekeeper.ServerURI; -- cgit v1.1