From 19558f380a1e9cbaff849eb15262266ea79b60d2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 13 Jun 2010 19:06:22 -0700 Subject: Fixes the long-standing RegionUp bug! Plus lots of other cleanups related to neighbours. --- .../Avatar/Attachments/AttachmentsModule.cs | 2 +- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 2 +- .../EntityTransfer/EntityTransferModule.cs | 28 +++++++++++++++++++++ .../Neighbour/NeighbourServiceInConnectorModule.cs | 5 +--- .../Grid/LocalGridServiceConnector.cs | 17 +------------ .../Grid/RemoteGridServiceConnector.cs | 5 +--- .../Neighbour/LocalNeighbourServiceConnector.cs | 8 +++--- .../Simulation/RemoteSimulationConnector.cs | 1 - OpenSim/Region/Framework/Scenes/Scene.cs | 29 +++------------------- .../Framework/Scenes/SceneCommunicationService.cs | 21 ++++++---------- .../Connectors/Grid/GridServiceConnector.cs | 9 +++---- .../Simulation/SimulationServiceConnector.cs | 2 +- OpenSim/Services/GridService/GridService.cs | 5 ++-- 13 files changed, 55 insertions(+), 79 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 6d16c52..a7b4c66 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -352,7 +352,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // Save avatar attachment information if (m_scene.AvatarFactory != null) { - m_log.Debug("[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", ItemID: " + itemID); + m_log.Debug("[ATTACHMENTS MODULE]: Dettaching from UserID: " + remoteClient.AgentId + ", ItemID: " + itemID); m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); } } diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 22c8937..7e5a8ec 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -198,7 +198,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory public void UpdateDatabase(UUID user, AvatarAppearance appearance) { - //m_log.DebugFormat("[APPEARANCE]: UpdateDatabase"); + m_log.DebugFormat("[APPEARANCE]: UpdateDatabase"); AvatarData adata = new AvatarData(appearance); m_scene.AvatarService.SetAvatar(user, adata); } diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 5d50a83..ab1cfc3 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -922,12 +922,40 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// public void EnableChildAgent(ScenePresence sp, GridRegion region) { + m_log.DebugFormat("[ENTITY TRANSFER]: Enabling child agent in new neighour {0}", region.RegionName); + + AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); AgentCircuitData agent = sp.ControllingClient.RequestClientInfo(); agent.BaseFolder = UUID.Zero; agent.InventoryFolder = UUID.Zero; agent.startpos = new Vector3(128, 128, 70); agent.child = true; agent.Appearance = sp.Appearance; + agent.CapsPath = CapsUtil.GetRandomCapsObjectPath(); + + agent.ChildrenCapSeeds = new Dictionary(sp.Scene.CapsModule.GetChildrenSeeds(sp.UUID)); + m_log.DebugFormat("[XXX] Seeds 1 {0}", agent.ChildrenCapSeeds.Count); + + if (!agent.ChildrenCapSeeds.ContainsKey(sp.Scene.RegionInfo.RegionHandle)) + agent.ChildrenCapSeeds.Add(sp.Scene.RegionInfo.RegionHandle, sp.ControllingClient.RequestClientInfo().CapsPath); + m_log.DebugFormat("[XXX] Seeds 2 {0}", agent.ChildrenCapSeeds.Count); + + sp.AddNeighbourRegion(region.RegionHandle, agent.CapsPath); + foreach (ulong h in agent.ChildrenCapSeeds.Keys) + m_log.DebugFormat("[XXX] --> {0}", h); + m_log.DebugFormat("[XXX] Adding {0}", region.RegionHandle); + agent.ChildrenCapSeeds.Add(region.RegionHandle, agent.CapsPath); + + if (sp.Scene.CapsModule != null) + { + sp.Scene.CapsModule.SetChildrenSeed(sp.UUID, agent.ChildrenCapSeeds); + } + + if (currentAgentCircuit != null) + { + agent.ServiceURLs = currentAgentCircuit.ServiceURLs; + agent.Viewer = currentAgentCircuit.Viewer; + } InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; d.BeginInvoke(sp, agent, region, region.ExternalEndPoint, true, diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs index 8a90370..35518d5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs @@ -123,17 +123,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) { - m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}", - thisRegion.RegionName, regionHandle, m_Scenes.Count); foreach (Scene s in m_Scenes) { if (s.RegionInfo.RegionHandle == regionHandle) { - m_log.Debug("[NEIGHBOUR IN CONNECTOR]: Found region to SendHelloNeighbour"); + //m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: HelloNeighbour from {0} to {1}", thisRegion.RegionName, s.RegionInfo.RegionName); return s.IncomingHelloNeighbour(thisRegion); } } - m_log.DebugFormat("[NEIGHBOUR IN CONNECTOR]: region handle {0} not found", regionHandle); return null; } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 1b00c8a..b2e3f4f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -181,22 +181,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public List GetNeighbours(UUID scopeID, UUID regionID) { - if (m_LocalCache.ContainsKey(regionID)) - { - List neighbours = m_LocalCache[regionID].GetNeighbours(); - if (neighbours.Count == 0) - // try the DB - neighbours = m_GridService.GetNeighbours(scopeID, regionID); - return neighbours; - } - else - { - m_log.WarnFormat("[LOCAL GRID CONNECTOR]: GetNeighbours: Requested region {0} is not on this sim", regionID); - return new List(); - } - - // Don't go to the DB - //return m_GridService.GetNeighbours(scopeID, regionID); + return m_GridService.GetNeighbours(scopeID, regionID); } public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index 46741a5..16e25e6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs @@ -153,12 +153,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid return false; } - // Let's override GetNeighbours completely -- never go to the grid server - // Neighbours are/should be cached locally - // For retrieval from the DB, caller should call GetRegionByPosition public override List GetNeighbours(UUID scopeID, UUID regionID) { - return m_LocalGridService.GetNeighbours(scopeID, regionID); + return base.GetNeighbours(scopeID, regionID); } public override GridRegion GetRegionByUUID(UUID scopeID, UUID regionID) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs index daba0b3..f71bf46 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Neighbour/LocalNeighbourServiceConnector.cs @@ -121,17 +121,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour public GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) { - m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}", - thisRegion.RegionName, regionHandle, m_Scenes.Count); + m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}.", + thisRegion.RegionName, regionHandle); foreach (Scene s in m_Scenes) { if (s.RegionInfo.RegionHandle == regionHandle) { - m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour"); + //m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour"); return s.IncomingHelloNeighbour(thisRegion); } } - m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle); + //m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle); return null; } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 9e8454f..3f577f2 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs @@ -181,7 +181,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation // else do the remote thing if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) { - //m_regionClient.SendUserInformation(regInfo, aCircuit); return m_remoteConnector.CreateAgent(destination, aCircuit, teleportFlags, out reason); } return false; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 55060c3..2ff611e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -948,12 +948,6 @@ namespace OpenSim.Region.Framework.Scenes // Let the grid service module know, so this can be cached m_eventManager.TriggerOnRegionUp(otherRegion); - RegionInfo regInfo = new RegionInfo(xcell, ycell, otherRegion.InternalEndPoint, otherRegion.ExternalHostName); - regInfo.RegionID = otherRegion.RegionID; - regInfo.RegionName = otherRegion.RegionName; - regInfo.ScopeID = otherRegion.ScopeID; - regInfo.ExternalHostName = otherRegion.ExternalHostName; - GridRegion r = new GridRegion(regInfo); try { ForEachScenePresence(delegate(ScenePresence agent) @@ -968,7 +962,7 @@ namespace OpenSim.Region.Framework.Scenes old.Add(otherRegion.RegionHandle); agent.DropOldNeighbours(old); if (m_teleportModule != null) - m_teleportModule.EnableChildAgent(agent, r); + m_teleportModule.EnableChildAgent(agent, otherRegion); } } ); @@ -1518,6 +1512,7 @@ namespace OpenSim.Region.Framework.Scenes { m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); LoginsDisabled = false; + m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo); } } } @@ -1802,6 +1797,8 @@ namespace OpenSim.Region.Framework.Scenes { RegisterCommsEvents(); + m_sceneGridService.SetScene(this); + // These two 'commands' *must be* next to each other or sim rebooting fails. //m_sceneGridService.RegisterRegion(m_interregionCommsOut, RegionInfo); @@ -1812,24 +1809,6 @@ namespace OpenSim.Region.Framework.Scenes throw new Exception(error); } - m_sceneGridService.SetScene(this); - m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo); - - //Dictionary dGridSettings = m_sceneGridService.GetGridSettings(); - - //if (dGridSettings.ContainsKey("allow_forceful_banlines")) - //{ - // if (dGridSettings["allow_forceful_banlines"] != "TRUE") - // { - // m_log.Info("[GRID]: Grid is disabling forceful parcel banlists"); - // EventManager.TriggerSetAllowForcefulBan(false); - // } - // else - // { - // m_log.Info("[GRID]: Grid is allowing forceful parcel banlists"); - // EventManager.TriggerSetAllowForcefulBan(true); - // } - //} } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index bd8ccce..c675322 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -182,24 +182,17 @@ namespace OpenSim.Region.Framework.Scenes { //m_log.Info("[INTER]: " + debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); - for (int x = (int)region.RegionLocX - 1; x <= region.RegionLocX + 1; x++) + List neighbours = m_scene.GridService.GetNeighbours(m_scene.RegionInfo.ScopeID, m_scene.RegionInfo.RegionID); + m_log.DebugFormat("[INTERGRID]: Informing {0} neighbours that this region is up", neighbours.Count); + foreach (GridRegion n in neighbours) { - for (int y = (int)region.RegionLocY - 1; y <= region.RegionLocY + 1; y++) - { - if (!((x == region.RegionLocX) && (y == region.RegionLocY))) // skip this region - { - ulong handle = Utils.UIntsToLong((uint)x * Constants.RegionSize, (uint)y * Constants.RegionSize); - InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; - - d.BeginInvoke(neighbourService, region, handle, - InformNeighborsThatRegionisUpCompleted, - d); - } - } + InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync; + d.BeginInvoke(neighbourService, region, n.RegionHandle, + InformNeighborsThatRegionisUpCompleted, + d); } } - public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, ulong regionHandle); /// diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 0ec8912..1831533 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs @@ -210,9 +210,6 @@ namespace OpenSim.Services.Connectors GridRegion rinfo = new GridRegion((Dictionary)r); rinfos.Add(rinfo); } - else - m_log.DebugFormat("[GRID CONNECTOR]: GetNeighbours {0}, {1} received invalid response type {2}", - scopeID, regionID, r.GetType()); } } else @@ -299,9 +296,9 @@ namespace OpenSim.Services.Connectors { if (replyData["result"] is Dictionary) rinfo = new GridRegion((Dictionary)replyData["result"]); - else - m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received no region", - scopeID, x, y); + //else + // m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received no region", + // scopeID, x, y); } else m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received null response", diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index ff0dd7e..32f02fb 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -479,7 +479,7 @@ namespace OpenSim.Services.Connectors.Simulation } catch (WebException ex) { - m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent delete {0}", ex.Message); + m_log.InfoFormat("[REMOTE SIMULATION CONNECTOR]: exception on reply of agent delete from {0}: {1}", destination.RegionName, ex.Message); return false; } finally diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 7c98642..225530f 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs @@ -273,14 +273,15 @@ namespace OpenSim.Services.GridService if (region != null) { // Not really? Maybe? - List rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize, region.posY - (int)Constants.RegionSize, - region.posX + (int)Constants.RegionSize, region.posY + (int)Constants.RegionSize, scopeID); + List rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize - 1, region.posY - (int)Constants.RegionSize - 1, + region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID); foreach (RegionData rdata in rdatas) if (rdata.RegionID != regionID) rinfos.Add(RegionData2RegionInfo(rdata)); } + m_log.DebugFormat("[GRID SERVICE]: region {0} has {1} neighours", region.RegionName, rinfos.Count); return rinfos; } -- cgit v1.1