A few more tweaks on position updates and create child agents. Mono hates concurrent uses of the same TCP connection, and even of the connections to the same server. So let's stop doing it. This patch makes movement much smoother when there are lots of neighbours.

xassetservice
Diva Canto 2012-02-19 12:28:07 -08:00
parent 2ffc055f7e
commit 20c65ac438
3 changed files with 22 additions and 10 deletions

View File

@ -1258,12 +1258,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle)
{ {
InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
try try
{ {
d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, // Let's put this back at sync, so that it doesn't clog
InformClientOfNeighbourCompleted, // the network, especially for regions in the same physical server.
d); // We're really not in a hurry here.
InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent);
//InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync;
//d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent,
// InformClientOfNeighbourCompleted,
// d);
} }
catch (ArgumentOutOfRangeException) catch (ArgumentOutOfRangeException)

View File

@ -140,6 +140,7 @@ 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.
@ -156,16 +157,22 @@ namespace OpenSim.Region.Framework.Scenes
// that the region position is cached or performance will degrade // that the region position is cached or performance will degrade
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);
if (! simulatorList.Contains(dest.ServerURI)) bool v = true;
if (! simulatorList.Contains(dest.ServerURI) && !_failedSims.TryGetValue(dest.ServerURI, out v))
{ {
// 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.
if (!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);
SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; // Leaving this here as a reminder that we tried, and it sucks.
d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, dest, //SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync;
SendChildAgentDataUpdateCompleted, //d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, dest,
d); // SendChildAgentDataUpdateCompleted,
// d);
} }
} }
} }

View File

@ -2738,7 +2738,8 @@ namespace OpenSim.Region.Framework.Scenes
AgentPosition agentpos = new AgentPosition(); AgentPosition agentpos = new AgentPosition();
agentpos.CopyFrom(cadu); agentpos.CopyFrom(cadu);
m_scene.SendOutChildAgentUpdates(agentpos, this); // Let's get this out of the update loop
Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); });
} }
} }