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