aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs60
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs56
2 files changed, 85 insertions, 31 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 68af360..3309431 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -277,15 +277,41 @@ namespace OpenSim.Region.Environment.Scenes
277 // This fails to get the desired effect and needs further work. 277 // This fails to get the desired effect and needs further work.
278 if (RegionInfo.RegionHandle != otherRegion.RegionHandle) 278 if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
279 { 279 {
280 if (!(m_regionRestartNotifyList.Contains(otherRegion))) 280 if (Math.Abs(otherRegion.RegionLocX - RegionInfo.RegionLocX) <= 1 || Math.Abs(otherRegion.RegionLocY - RegionInfo.RegionLocY) <= 1)
281 { 281 {
282 m_regionRestartNotifyList.Add(otherRegion); 282 try
283 283 {
284 m_restartWaitTimer = new Timer(20000); 284
285 m_restartWaitTimer.AutoReset = false; 285 ForEachScenePresence(delegate(ScenePresence agent)
286 m_restartWaitTimer.Elapsed += new ElapsedEventHandler(restart_Notify_Wait_Elapsed); 286 {
287 m_restartWaitTimer.Start(); 287 if (!(agent.IsChildAgent))
288 {
289 //agent.ControllingClient.new
290 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
291 InformClientOfNeighbor(agent, otherRegion);
292 }
293 }
294
295 );
296 }
297 catch (System.NullReferenceException)
298 {
299 // This means that we're not booted up completely yet.
300 }
301 }
302 else
303 {
304 MainLog.Instance.Verbose("INTERGRID", "Got notice about Region at X:" + otherRegion.RegionLocX.ToString() + " Y:" + otherRegion.RegionLocY.ToString() + " but it was too far away to send to the client");
288 } 305 }
306 //if (!(m_regionRestartNotifyList.Contains(otherRegion)))
307 //{
308 //m_regionRestartNotifyList.Add(otherRegion);
309
310 //m_restartWaitTimer = new Timer(20000);
311 //m_restartWaitTimer.AutoReset = false;
312 // m_restartWaitTimer.Elapsed += new ElapsedEventHandler(restart_Notify_Wait_Elapsed);
313 //m_restartWaitTimer.Start();
314 //}
289 } 315 }
290 return true; 316 return true;
291 } 317 }
@@ -342,25 +368,7 @@ namespace OpenSim.Region.Environment.Scenes
342 m_restartWaitTimer.Stop(); 368 m_restartWaitTimer.Stop();
343 foreach (RegionInfo region in m_regionRestartNotifyList) 369 foreach (RegionInfo region in m_regionRestartNotifyList)
344 { 370 {
345 try 371
346 {
347
348 ForEachScenePresence(delegate(ScenePresence agent)
349 {
350 if (!(agent.IsChildAgent))
351 {
352 //agent.ControllingClient.new
353 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
354 InformClientOfNeighbor(agent, region);
355 }
356 }
357
358 );
359 }
360 catch (System.NullReferenceException)
361 {
362 // This means that we're not booted up completely yet.
363 }
364 } 372 }
365 // Reset list to nothing. 373 // Reset list to nothing.
366 m_regionRestartNotifyList = new List<RegionInfo>(); 374 m_regionRestartNotifyList = new List<RegionInfo>();
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 892bf81..aad78d5 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -58,6 +58,7 @@ namespace OpenSim.Region.Environment.Scenes
58 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString()); 58 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: registered with gridservice and got" + regionCommsHost.ToString());
59 59
60 regionCommsHost.debugRegionName = _debugRegionName; 60 regionCommsHost.debugRegionName = _debugRegionName;
61
61 regionCommsHost.OnExpectUser += NewUserConnection; 62 regionCommsHost.OnExpectUser += NewUserConnection;
62 regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing; 63 regionCommsHost.OnAvatarCrossingIntoRegion += AgentCrossing;
63 regionCommsHost.OnPrimCrossingIntoRegion += PrimCrossing; 64 regionCommsHost.OnPrimCrossingIntoRegion += PrimCrossing;
@@ -222,7 +223,56 @@ namespace OpenSim.Region.Environment.Scenes
222 } 223 }
223 224
224 #endregion 225 #endregion
226 public delegate void InformNeighbourThatRegionUpDelegate(RegionInfo region, ulong regionhandle);
227
228 private void InformNeighborsThatRegionisUpCompleted(IAsyncResult iar)
229 {
230 InformNeighbourThatRegionUpDelegate icon = (InformNeighbourThatRegionUpDelegate)iar.AsyncState;
231 icon.EndInvoke(iar);
232 }
233
234
235 private void InformNeighboursThatRegionIsUpAsync(RegionInfo region, ulong regionhandle)
236 {
237 MainLog.Instance.Notice("INTERGRID", "Starting to inform neighbors that I'm here");
238 bool regionAccepted = m_commsProvider.InterRegion.RegionUp((new SearializableRegionInfo(region)), regionhandle);
239
240 if (regionAccepted)
241 {
242 MainLog.Instance.Notice("INTERGRID", "Completed informing neighbors that I'm here");
243 }
244 else
245 {
246 MainLog.Instance.Notice("INTERGRID", "Failed to inform neighbors that I'm here");
247 }
248 }
225 249
250 public void InformNeighborsThatRegionisUp(RegionInfo region)
251 {
252 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
253 List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
254
255 lock (neighbours)
256 {
257 neighbours = m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
258 if (neighbours != null)
259 {
260 for (int i = 0; i < neighbours.Count; i++)
261 {
262
263 InformNeighbourThatRegionUpDelegate d = InformNeighboursThatRegionIsUpAsync;
264 // race condition! Arg! I hate race conditions.
265 lock (d)
266 {
267 d.BeginInvoke(region, neighbours[i].RegionHandle,
268 InformNeighborsThatRegionisUpCompleted,
269 d);
270 }
271 }
272 }
273 }
274 //bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region));
275 }
226 /// <summary> 276 /// <summary>
227 /// 277 ///
228 /// </summary> 278 /// </summary>
@@ -320,11 +370,7 @@ namespace OpenSim.Region.Environment.Scenes
320 return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying); 370 return m_commsProvider.InterRegion.ExpectAvatarCrossing(regionhandle, agentID, position, isFlying);
321 } 371 }
322 372
323 public void InformNeighborsThatRegionisUp(RegionInfo region) 373
324 {
325 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
326 bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region));
327 }
328 374
329 public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, LLVector3 position, bool isPhysical) 375 public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, LLVector3 position, bool isPhysical)
330 { 376 {