Merge branch 'master' into careminster-presence-refactor

This commit is contained in:
Melanie
2010-06-14 02:49:15 +01:00
21 changed files with 709 additions and 445 deletions

View File

@@ -373,7 +373,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);
}
}

View File

@@ -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);
}

View File

@@ -396,7 +396,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
agent.Position = position;
SetCallbackURL(agent, sp.Scene.RegionInfo);
UpdateAgent(reg, finalDestination, agent);
if (!UpdateAgent(reg, finalDestination, agent))
{
// Region doesn't take it
Fail(sp, finalDestination);
return;
}
m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, sp.UUID);
@@ -421,21 +426,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// that the client contacted the destination before we send the attachments and close things here.
if (!WaitForCallback(sp.UUID))
{
// Client never contacted destination. Let's restore everything back
sp.ControllingClient.SendTeleportFailed("Problems connecting to destination.");
// Fail. Reset it back
sp.IsChildAgent = false;
ResetFromTransit(sp.UUID);
// Yikes! We should just have a ref to scene here.
//sp.Scene.InformClientOfNeighbours(sp);
EnableChildAgents(sp);
// Finally, kill the agent we just created at the destination.
m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID);
Fail(sp, finalDestination);
return;
}
@@ -475,6 +466,22 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
}
}
private void Fail(ScenePresence sp, GridRegion finalDestination)
{
// Client never contacted destination. Let's restore everything back
sp.ControllingClient.SendTeleportFailed("Problems connecting to destination.");
// Fail. Reset it back
sp.IsChildAgent = false;
ResetFromTransit(sp.UUID);
EnableChildAgents(sp);
// Finally, kill the agent we just created at the destination.
m_aScene.SimulationService.CloseAgent(finalDestination, sp.UUID);
}
protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
{
@@ -813,7 +820,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
cAgent.CallbackURI = "http://" + m_scene.RegionInfo.ExternalHostName + ":" + m_scene.RegionInfo.HttpPort +
"/agent/" + agent.UUID.ToString() + "/" + m_scene.RegionInfo.RegionID.ToString() + "/release/";
m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent);
if (!m_scene.SimulationService.UpdateAgent(neighbourRegion, cAgent))
{
// region doesn't take it
ResetFromTransit(agent.UUID);
return agent;
}
// Next, let's close the child agent connections that are too far away.
agent.CloseChildAgents(neighbourx, neighboury);
@@ -914,12 +926,40 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// </summary>
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<ulong, string>(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;
}
IPEndPoint external = region.ExternalEndPoint;
if (external != null)

View File

@@ -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;
}

View File

@@ -181,22 +181,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
{
if (m_LocalCache.ContainsKey(regionID))
{
List<GridRegion> 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<GridRegion>();
}
// 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)

View File

@@ -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<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
{
return m_LocalGridService.GetNeighbours(scopeID, regionID);
return base.GetNeighbours(scopeID, regionID);
}
public override GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)

View File

@@ -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;
}

View File

@@ -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;