avoid a null ref (that should not happen after last commit), also reduce use of thread jobs, where one is good enought
parent
3906bb2749
commit
b9137e2dee
|
@ -234,6 +234,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y);
|
GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y);
|
||||||
|
|
||||||
|
if (destination == null)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} FAIL, region with handle {1} not found", agentID, regionHandle);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_log.DebugFormat(
|
m_log.DebugFormat(
|
||||||
"[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} to {1}", agentID, destination.RegionName);
|
"[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} to {1}", agentID, destination.RegionName);
|
||||||
|
|
||||||
|
@ -247,17 +254,18 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="agentID"></param>
|
/// <param name="agentID"></param>
|
||||||
/// <param name="regionslst"></param>
|
/// <param name="regionslst"></param>
|
||||||
public void SendCloseChildAgentConnections(UUID agentID, string auth_code, List<ulong> regionslst)
|
public void SendCloseChildAgentConnections(UUID agentID, string auth_code, List<ulong> regionslst)
|
||||||
|
{
|
||||||
|
if (regionslst.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// use a single thread job for all
|
||||||
|
Util.FireAndForget(o =>
|
||||||
{
|
{
|
||||||
foreach (ulong handle in regionslst)
|
foreach (ulong handle in regionslst)
|
||||||
{
|
{
|
||||||
// We must take a copy here since handle acts like a reference when used in an iterator.
|
SendCloseChildAgent(agentID, handle, auth_code);
|
||||||
// This leads to race conditions if directly passed to SendCloseChildAgent with more than one neighbour region.
|
|
||||||
ulong handleCopy = handle;
|
|
||||||
Util.FireAndForget(
|
|
||||||
o => SendCloseChildAgent(agentID, handleCopy, auth_code),
|
|
||||||
null,
|
|
||||||
"SceneCommunicationService.SendCloseChildAgentConnections");
|
|
||||||
}
|
}
|
||||||
|
}, null, "SceneCommunicationService.SendCloseChildAgentConnections");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GridRegion> RequestNamedRegions(string name, int maxNumber)
|
public List<GridRegion> RequestNamedRegions(string name, int maxNumber)
|
||||||
|
|
Loading…
Reference in New Issue