diff options
author | onefang | 2019-05-19 21:24:15 +1000 |
---|---|---|
committer | onefang | 2019-05-19 21:24:15 +1000 |
commit | 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch) | |
tree | a9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |
parent | Add a build script. (diff) | |
download | opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2 opensim-SC_OLD-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz |
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index b9526da..6304778 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 |
@@ -218,8 +218,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | public delegate void SendCloseChildAgentDelegate(UUID agentID, ulong regionHandle); | ||
222 | |||
221 | /// <summary> | 223 | /// <summary> |
222 | /// Closes a child agent on a given region | 224 | /// This Closes child agents on neighboring regions |
225 | /// Calls an asynchronous method to do so.. so it doesn't lag the sim. | ||
223 | /// </summary> | 226 | /// </summary> |
224 | protected void SendCloseChildAgent(UUID agentID, ulong regionHandle, string auth_token) | 227 | protected void SendCloseChildAgent(UUID agentID, ulong regionHandle, string auth_token) |
225 | { | 228 | { |
@@ -231,6 +234,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
231 | 234 | ||
232 | 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); |
233 | 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 | |||
234 | m_log.DebugFormat( | 244 | m_log.DebugFormat( |
235 | "[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); |
236 | 246 | ||
@@ -238,28 +248,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
238 | } | 248 | } |
239 | 249 | ||
240 | /// <summary> | 250 | /// <summary> |
241 | /// Closes a child agents in a collection of regions. Does so asynchronously | 251 | /// Closes a child agents in a collection of regions. Does so asynchronously |
242 | /// so that the caller doesn't wait. | 252 | /// so that the caller doesn't wait. |
243 | /// </summary> | 253 | /// </summary> |
244 | /// <param name="agentID"></param> | 254 | /// <param name="agentID"></param> |
245 | /// <param name="regionslst"></param> | 255 | /// <param name="regionslst"></param> |
246 | public void SendCloseChildAgentConnections(UUID agentID, string auth_code, List<ulong> regionslst) | 256 | public void SendCloseChildAgentConnections(UUID agentID, string auth_code, List<ulong> regionslst) |
247 | { | 257 | { |
248 | 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 => | ||
249 | { | 263 | { |
250 | // We must take a copy here since handle is acts like a reference when used in an iterator. | 264 | foreach (ulong handle in regionslst) |
251 | // This leads to race conditions if directly passed to SendCloseChildAgent with more than one neighbour region. | 265 | { |
252 | ulong handleCopy = handle; | 266 | SendCloseChildAgent(agentID, handle, auth_code); |
253 | Util.FireAndForget( | 267 | } |
254 | o => SendCloseChildAgent(agentID, handleCopy, auth_code), | 268 | }, null, "SceneCommunicationService.SendCloseChildAgentConnections"); |
255 | null, | ||
256 | "SceneCommunicationService.SendCloseChildAgentConnections"); | ||
257 | } | ||
258 | } | 269 | } |
259 | 270 | ||
260 | public List<GridRegion> RequestNamedRegions(string name, int maxNumber) | 271 | public List<GridRegion> RequestNamedRegions(string name, int maxNumber) |
261 | { | 272 | { |
262 | return m_scene.GridService.GetRegionsByName(UUID.Zero, name, maxNumber); | 273 | return m_scene.GridService.GetRegionsByName(UUID.Zero, name, maxNumber); |
263 | } | 274 | } |
264 | } | 275 | } |
265 | } \ No newline at end of file | 276 | } |