Merge branch 'master' into careminster

avinationmerge
Melanie 2012-02-20 19:48:28 +00:00
commit 3b2900e884
4 changed files with 23 additions and 13 deletions

View File

@ -949,6 +949,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
neighbourRegion.RegionHandle); neighbourRegion.RegionHandle);
return agent; return agent;
} }
// No turning back
agent.IsChildAgent = true;
string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps);
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID);
@ -1097,7 +1100,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// <summary> /// <summary>
/// This informs all neighbouring regions about agent "avatar". /// This informs all neighbouring regions about agent "avatar".
/// Calls an asynchronous method to do so.. so it doesn't lag the sim.
/// </summary> /// </summary>
/// <param name="sp"></param> /// <param name="sp"></param>
public void EnableChildAgents(ScenePresence sp) public void EnableChildAgents(ScenePresence sp)

View File

@ -140,7 +140,6 @@ namespace OpenSim.Region.Framework.Scenes
icon.EndInvoke(iar); icon.EndInvoke(iar);
} }
ExpiringCache<string, bool> _failedSims = new ExpiringCache<string, bool>();
public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence) public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence)
{ {
// This assumes that we know what our neighbors are. // This assumes that we know what our neighbors are.
@ -158,15 +157,13 @@ namespace OpenSim.Region.Framework.Scenes
Utils.LongToUInts(regionHandle, out x, out y); Utils.LongToUInts(regionHandle, out x, out y);
GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y);
bool v = true; bool v = true;
if (! simulatorList.Contains(dest.ServerURI) && !_failedSims.TryGetValue(dest.ServerURI, out v)) if (! simulatorList.Contains(dest.ServerURI))
{ {
// we havent seen this simulator before, add it to the list // we havent seen this simulator before, add it to the list
// and send it an update // and send it an update
simulatorList.Add(dest.ServerURI); simulatorList.Add(dest.ServerURI);
// Let move this to sync. Mono definitely does not like async networking. // Let move this to sync. Mono definitely does not like async networking.
if (!m_scene.SimulationService.UpdateAgent(dest, cAgentData)) m_scene.SimulationService.UpdateAgent(dest, cAgentData);
// Also if it fails, get it out of the loop for a bit
_failedSims.Add(dest.ServerURI, true, 120);
// Leaving this here as a reminder that we tried, and it sucks. // Leaving this here as a reminder that we tried, and it sucks.
//SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; //SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;

View File

@ -1255,7 +1255,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>(); IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface<IEntityTransferModule>();
if (m_agentTransfer != null) if (m_agentTransfer != null)
m_agentTransfer.EnableChildAgents(this); Util.FireAndForget(delegate { m_agentTransfer.EnableChildAgents(this); });
IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
if (friendsModule != null) if (friendsModule != null)

View File

@ -153,6 +153,7 @@ namespace OpenSim.Services.Connectors.Simulation
return UpdateAgent(destination, (IAgentData)data, 200000); // yes, 200 seconds return UpdateAgent(destination, (IAgentData)data, 200000); // yes, 200 seconds
} }
private ExpiringCache<string, bool> _failedSims = new ExpiringCache<string, bool>();
/// <summary> /// <summary>
/// Send updated position information about an agent in this region to a neighbor /// Send updated position information about an agent in this region to a neighbor
/// This operation may be called very frequently if an avatar is moving about in /// This operation may be called very frequently if an avatar is moving about in
@ -160,6 +161,10 @@ namespace OpenSim.Services.Connectors.Simulation
/// </summary> /// </summary>
public bool UpdateAgent(GridRegion destination, AgentPosition data) public bool UpdateAgent(GridRegion destination, AgentPosition data)
{ {
bool v = true;
if (_failedSims.TryGetValue(destination.ServerURI, out v))
return false;
// The basic idea of this code is that the first thread that needs to // The basic idea of this code is that the first thread that needs to
// send an update for a specific avatar becomes the worker for any subsequent // send an update for a specific avatar becomes the worker for any subsequent
// requests until there are no more outstanding requests. Further, only send the most // requests until there are no more outstanding requests. Further, only send the most
@ -183,9 +188,10 @@ namespace OpenSim.Services.Connectors.Simulation
// Otherwise update the reference and start processing // Otherwise update the reference and start processing
m_updateAgentQueue[uri] = data; m_updateAgentQueue[uri] = data;
} }
AgentPosition pos = null; AgentPosition pos = null;
while (true) bool success = true;
while (success)
{ {
lock (m_updateAgentQueue) lock (m_updateAgentQueue)
{ {
@ -205,11 +211,16 @@ namespace OpenSim.Services.Connectors.Simulation
} }
} }
UpdateAgent(destination, (IAgentData)pos, 10000); success = UpdateAgent(destination, (IAgentData)pos, 10000);
} }
// we get here iff success == false
// unreachable // blacklist sim for 2 minutes
// return true; lock (m_updateAgentQueue)
{
_failedSims.AddOrUpdate(destination.ServerURI, true, 120);
m_updateAgentQueue.Remove(uri);
}
return false;
} }
/// <summary> /// <summary>