diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index c8af4c3..19cb0c1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -189,7 +189,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
189 | } | 189 | } |
190 | } | 190 | } |
191 | 191 | ||
192 | public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, UUID scopeID, ulong regionHandle); | 192 | public delegate void SendChildAgentDataUpdateDelegate(AgentPosition cAgentData, UUID scopeID, GridRegion dest); |
193 | |||
193 | 194 | ||
194 | /// <summary> | 195 | /// <summary> |
195 | /// This informs all neighboring regions about the settings of it's child agent. | 196 | /// This informs all neighboring regions about the settings of it's child agent. |
@@ -198,31 +199,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
198 | /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. | 199 | /// This contains information, such as, Draw Distance, Camera location, Current Position, Current throttle settings, etc. |
199 | /// | 200 | /// |
200 | /// </summary> | 201 | /// </summary> |
201 | private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, UUID scopeID, ulong regionHandle) | 202 | private void SendChildAgentDataUpdateAsync(AgentPosition cAgentData, UUID scopeID, GridRegion dest) |
202 | { | 203 | { |
203 | //m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName); | 204 | //m_log.Info("[INTERGRID]: Informing neighbors about my agent in " + m_regionInfo.RegionName); |
204 | try | 205 | try |
205 | { | 206 | { |
206 | //m_commsProvider.InterRegion.ChildAgentUpdate(regionHandle, cAgentData); | 207 | m_scene.SimulationService.UpdateAgent(dest, cAgentData); |
207 | uint x = 0, y = 0; | ||
208 | Utils.LongToUInts(regionHandle, out x, out y); | ||
209 | GridRegion destination = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
210 | m_scene.SimulationService.UpdateAgent(destination, cAgentData); | ||
211 | } | 208 | } |
212 | catch | 209 | catch |
213 | { | 210 | { |
214 | // Ignore; we did our best | 211 | // Ignore; we did our best |
215 | } | 212 | } |
216 | |||
217 | //if (regionAccepted) | ||
218 | //{ | ||
219 | // //m_log.Info("[INTERGRID]: Completed sending a neighbor an update about my agent"); | ||
220 | //} | ||
221 | //else | ||
222 | //{ | ||
223 | // //m_log.Info("[INTERGRID]: Failed sending a neighbor an update about my agent"); | ||
224 | //} | ||
225 | |||
226 | } | 213 | } |
227 | 214 | ||
228 | private void SendChildAgentDataUpdateCompleted(IAsyncResult iar) | 215 | private void SendChildAgentDataUpdateCompleted(IAsyncResult iar) |
@@ -236,14 +223,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
236 | // This assumes that we know what our neighbors are. | 223 | // This assumes that we know what our neighbors are. |
237 | try | 224 | try |
238 | { | 225 | { |
226 | uint x = 0, y = 0; | ||
227 | List<string> simulatorList = new List<string>(); | ||
239 | foreach (ulong regionHandle in presence.KnownChildRegionHandles) | 228 | foreach (ulong regionHandle in presence.KnownChildRegionHandles) |
240 | { | 229 | { |
241 | if (regionHandle != m_regionInfo.RegionHandle) | 230 | if (regionHandle != m_regionInfo.RegionHandle) |
242 | { | 231 | { |
243 | SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; | 232 | // we only want to send one update to each simulator; the simulator will |
244 | d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, regionHandle, | 233 | // hand it off to the regions where a child agent exists, this does assume |
245 | SendChildAgentDataUpdateCompleted, | 234 | // that the region position is cached or performance will degrade |
246 | d); | 235 | Utils.LongToUInts(regionHandle, out x, out y); |
236 | GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); | ||
237 | if (! simulatorList.Contains(dest.ServerURI)) | ||
238 | { | ||
239 | // we havent seen this simulator before, add it to the list | ||
240 | // and send it an update | ||
241 | simulatorList.Add(dest.ServerURI); | ||
242 | |||
243 | SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; | ||
244 | d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, dest, | ||
245 | SendChildAgentDataUpdateCompleted, | ||
246 | d); | ||
247 | } | ||
247 | } | 248 | } |
248 | } | 249 | } |
249 | } | 250 | } |