diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 28df1c1..3eefd3c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -66,7 +66,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
66 | 66 | ||
67 | private void InformNeighborsThatRegionisUpCompleted(IAsyncResult iar) | 67 | private void InformNeighborsThatRegionisUpCompleted(IAsyncResult iar) |
68 | { | 68 | { |
69 | InformNeighbourThatRegionUpDelegate icon = (InformNeighbourThatRegionUpDelegate) iar.AsyncState; | 69 | InformNeighbourThatRegionUpDelegate icon = (InformNeighbourThatRegionUpDelegate)iar.AsyncState; |
70 | icon.EndInvoke(iar); | 70 | icon.EndInvoke(iar); |
71 | } | 71 | } |
72 | 72 | ||
@@ -84,11 +84,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
84 | if (neighbourService != null) | 84 | if (neighbourService != null) |
85 | neighbour = neighbourService.HelloNeighbour(regionhandle, region); | 85 | neighbour = neighbourService.HelloNeighbour(regionhandle, region); |
86 | else | 86 | else |
87 | m_log.DebugFormat( "{0} neighbour service provided for region {0} to inform neigbhours of status", LogHeader, m_scene.Name); | 87 | m_log.DebugFormat("{0} neighbour service provided for region {0} to inform neigbhours of status", LogHeader, m_scene.Name); |
88 | 88 | ||
89 | if (neighbour != null) | 89 | if (neighbour != null) |
90 | { | 90 | { |
91 | m_log.DebugFormat( "{0} Region {1} successfully informed neighbour {2} at {3}-{4} that it is up", | 91 | m_log.DebugFormat("{0} Region {1} successfully informed neighbour {2} at {3}-{4} that it is up", |
92 | LogHeader, m_scene.Name, neighbour.RegionName, Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y)); | 92 | LogHeader, m_scene.Name, neighbour.RegionName, Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y)); |
93 | 93 | ||
94 | m_scene.EventManager.TriggerOnRegionUp(neighbour); | 94 | m_scene.EventManager.TriggerOnRegionUp(neighbour); |
@@ -114,9 +114,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
114 | { | 114 | { |
115 | OpenSim.Framework.RegionFlags? regionFlags = n.RegionFlags; | 115 | OpenSim.Framework.RegionFlags? regionFlags = n.RegionFlags; |
116 | 116 | ||
117 | // m_log.DebugFormat( | 117 | // m_log.DebugFormat( |
118 | // "{0}: Region flags for {1} as seen by {2} are {3}", | 118 | // "{0}: Region flags for {1} as seen by {2} are {3}", |
119 | // LogHeader, n.RegionName, m_scene.Name, regionFlags != null ? regionFlags.ToString() : "not present"); | 119 | // LogHeader, n.RegionName, m_scene.Name, regionFlags != null ? regionFlags.ToString() : "not present"); |
120 | 120 | ||
121 | // Robust services before 2015-01-14 do not return the regionFlags information. In this case, we could | 121 | // Robust services before 2015-01-14 do not return the regionFlags information. In this case, we could |
122 | // make a separate RegionFlags call but this would involve a network call for each neighbour. | 122 | // make a separate RegionFlags call but this would involve a network call for each neighbour. |
@@ -132,7 +132,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
132 | } | 132 | } |
133 | 133 | ||
134 | m_log.DebugFormat( | 134 | m_log.DebugFormat( |
135 | "{0} Informing {1} neighbours that region {2} is up", | 135 | "{0} Informing {1} neighbours that region {2} is up", |
136 | LogHeader, onlineNeighbours.Count, m_scene.Name); | 136 | LogHeader, onlineNeighbours.Count, m_scene.Name); |
137 | 137 | ||
138 | foreach (GridRegion n in onlineNeighbours) | 138 | foreach (GridRegion n in onlineNeighbours) |
@@ -168,15 +168,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
168 | 168 | ||
169 | private void SendChildAgentDataUpdateCompleted(IAsyncResult iar) | 169 | private void SendChildAgentDataUpdateCompleted(IAsyncResult iar) |
170 | { | 170 | { |
171 | SendChildAgentDataUpdateDelegate icon = (SendChildAgentDataUpdateDelegate) iar.AsyncState; | 171 | SendChildAgentDataUpdateDelegate icon = (SendChildAgentDataUpdateDelegate)iar.AsyncState; |
172 | icon.EndInvoke(iar); | 172 | icon.EndInvoke(iar); |
173 | } | 173 | } |
174 | 174 | ||
175 | public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence) | 175 | public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence) |
176 | { | 176 | { |
177 | // m_log.DebugFormat( | 177 | // m_log.DebugFormat( |
178 | // "[SCENE COMMUNICATION SERVICE]: Sending child agent position updates for {0} in {1}", | 178 | // "[SCENE COMMUNICATION SERVICE]: Sending child agent position updates for {0} in {1}", |
179 | // presence.Name, m_scene.Name); | 179 | // presence.Name, m_scene.Name); |
180 | 180 | ||
181 | // This assumes that we know what our neighbors are. | 181 | // This assumes that we know what our neighbors are. |
182 | try | 182 | try |
@@ -234,6 +234,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
234 | 234 | ||
235 | GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y); | 235 | GridRegion destination = m_scene.GridService.GetRegionByPosition(m_regionInfo.ScopeID, (int)x, (int)y); |
236 | 236 | ||
237 | if (destination == null) | ||
238 | { | ||
239 | m_log.DebugFormat( | ||
240 | "[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} FAIL, region with handle {1} not found", agentID, regionHandle); | ||
241 | return; | ||
242 | } | ||
243 | |||
237 | m_log.DebugFormat( | 244 | m_log.DebugFormat( |
238 | "[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} to {1}", agentID, destination.RegionName); | 245 | "[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} to {1}", agentID, destination.RegionName); |
239 | 246 | ||
@@ -248,16 +255,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
248 | /// <param name="regionslst"></param> | 255 | /// <param name="regionslst"></param> |
249 | public void SendCloseChildAgentConnections(UUID agentID, string auth_code, List<ulong> regionslst) | 256 | public void SendCloseChildAgentConnections(UUID agentID, string auth_code, List<ulong> regionslst) |
250 | { | 257 | { |
251 | foreach (ulong handle in regionslst) | 258 | if (regionslst.Count == 0) |
259 | return; | ||
260 | |||
261 | // use a single thread job for all | ||
262 | Util.FireAndForget(o => | ||
252 | { | 263 | { |
253 | // We must take a copy here since handle acts like a reference when used in an iterator. | 264 | foreach (ulong handle in regionslst) |
254 | // This leads to race conditions if directly passed to SendCloseChildAgent with more than one neighbour region. | 265 | { |
255 | ulong handleCopy = handle; | 266 | SendCloseChildAgent(agentID, handle, auth_code); |
256 | Util.FireAndForget( | 267 | } |
257 | o => SendCloseChildAgent(agentID, handleCopy, auth_code), | 268 | }, null, "SceneCommunicationService.SendCloseChildAgentConnections"); |
258 | null, | ||
259 | "SceneCommunicationService.SendCloseChildAgentConnections"); | ||
260 | } | ||
261 | } | 269 | } |
262 | 270 | ||
263 | public List<GridRegion> RequestNamedRegions(string name, int maxNumber) | 271 | public List<GridRegion> RequestNamedRegions(string name, int maxNumber) |