diff options
author | Teravus Ovares | 2007-11-29 02:07:19 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-11-29 02:07:19 +0000 |
commit | 81ba94fde8871df86e304a3dad7846059fd32045 (patch) | |
tree | e69bf4f58fe2a18576eac64f677de196d0f31278 /OpenSim/Region | |
parent | set svn:eol-style (diff) | |
download | opensim-SC-81ba94fde8871df86e304a3dad7846059fd32045.zip opensim-SC-81ba94fde8871df86e304a3dad7846059fd32045.tar.gz opensim-SC-81ba94fde8871df86e304a3dad7846059fd32045.tar.bz2 opensim-SC-81ba94fde8871df86e304a3dad7846059fd32045.tar.xz |
* Fixed about 7 issues with restarting sims and resolved interRegion comms issues. This includes the issue that MW described this morning.
There's a lot of little nit picky changes that make a world of difference.
Diffstat (limited to 'OpenSim/Region')
5 files changed, 205 insertions, 133 deletions
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 0f3ec73..17989d4 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs | |||
@@ -194,34 +194,35 @@ namespace OpenSim.Region.Communications.Local | |||
194 | return mapBlocks; | 194 | return mapBlocks; |
195 | } | 195 | } |
196 | 196 | ||
197 | /// <summary> | 197 | |
198 | /// </summary> | 198 | public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle) |
199 | /// <param name="regionHandle"></param> | ||
200 | /// <param name="agentData"></param> | ||
201 | /// <returns></returns> | ||
202 | /// | ||
203 | public bool RegionUp(SearializableRegionInfo sregion) | ||
204 | { | 199 | { |
205 | RegionInfo region = new RegionInfo(sregion); | 200 | RegionInfo region = new RegionInfo(sregion); |
206 | foreach (RegionCommsListener listener in m_regionListeners.Values) | 201 | if (m_regionListeners.ContainsKey(regionhandle)) |
207 | { | 202 | { |
208 | listener.TriggerRegionUp(region); | 203 | return m_regionListeners[regionhandle].TriggerRegionUp(region); |
209 | } | 204 | } |
210 | 205 | ||
211 | return false; | 206 | return false; |
212 | } | 207 | } |
213 | 208 | ||
214 | public bool TriggerRegionUp(RegionInfo region) | 209 | public bool TriggerRegionUp(RegionInfo region, ulong regionhandle) |
215 | { | 210 | { |
216 | 211 | ||
217 | foreach (RegionCommsListener listener in m_regionListeners.Values) | 212 | if (m_regionListeners.ContainsKey(regionhandle)) |
218 | { | 213 | { |
219 | listener.TriggerRegionUp(region); | 214 | return m_regionListeners[regionhandle].TriggerRegionUp(region); |
220 | } | 215 | } |
221 | 216 | ||
222 | return true; | 217 | return false; |
223 | } | 218 | } |
224 | 219 | ||
220 | /// <summary> | ||
221 | /// </summary> | ||
222 | /// <param name="regionHandle"></param> | ||
223 | /// <param name="agentData"></param> | ||
224 | /// <returns></returns> | ||
225 | /// | ||
225 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) | 226 | public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) |
226 | //should change from agentCircuitData | 227 | //should change from agentCircuitData |
227 | { | 228 | { |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index b0442d2..b91f4c2 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -248,39 +248,47 @@ namespace OpenSim.Region.Communications.OGS1 | |||
248 | } | 248 | } |
249 | else | 249 | else |
250 | { | 250 | { |
251 | Hashtable requestData = new Hashtable(); | 251 | try |
252 | requestData["region_handle"] = regionHandle.ToString(); | 252 | { |
253 | requestData["authkey"] = serversInfo.GridSendKey; | 253 | Hashtable requestData = new Hashtable(); |
254 | ArrayList SendParams = new ArrayList(); | 254 | requestData["region_handle"] = regionHandle.ToString(); |
255 | SendParams.Add(requestData); | 255 | requestData["authkey"] = serversInfo.GridSendKey; |
256 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | 256 | ArrayList SendParams = new ArrayList(); |
257 | XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); | 257 | SendParams.Add(requestData); |
258 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | ||
259 | XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); | ||
258 | 260 | ||
259 | Hashtable responseData = (Hashtable) GridResp.Value; | 261 | Hashtable responseData = (Hashtable)GridResp.Value; |
260 | 262 | ||
261 | if (responseData.ContainsKey("error")) | 263 | if (responseData.ContainsKey("error")) |
262 | { | 264 | { |
263 | Console.WriteLine("error received from grid server" + responseData["error"]); | 265 | Console.WriteLine("error received from grid server" + responseData["error"]); |
264 | return null; | 266 | return null; |
265 | } | 267 | } |
266 | 268 | ||
267 | uint regX = Convert.ToUInt32((string) responseData["region_locx"]); | 269 | uint regX = Convert.ToUInt32((string)responseData["region_locx"]); |
268 | uint regY = Convert.ToUInt32((string) responseData["region_locy"]); | 270 | uint regY = Convert.ToUInt32((string)responseData["region_locy"]); |
269 | string internalIpStr = (string) responseData["sim_ip"]; | 271 | string internalIpStr = (string)responseData["sim_ip"]; |
270 | uint port = Convert.ToUInt32(responseData["sim_port"]); | 272 | uint port = Convert.ToUInt32(responseData["sim_port"]); |
271 | string externalUri = (string) responseData["sim_uri"]; | 273 | string externalUri = (string)responseData["sim_uri"]; |
272 | 274 | ||
273 | IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); | 275 | IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int)port); |
274 | string neighbourExternalUri = externalUri; | 276 | string neighbourExternalUri = externalUri; |
275 | regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); | 277 | regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); |
276 | 278 | ||
277 | regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); | 279 | regionInfo.RemotingPort = Convert.ToUInt32((string)responseData["remoting_port"]); |
278 | regionInfo.RemotingAddress = internalIpStr; | 280 | regionInfo.RemotingAddress = internalIpStr; |
279 | 281 | ||
280 | regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); | 282 | regionInfo.RegionID = new LLUUID((string)responseData["region_UUID"]); |
281 | regionInfo.RegionName = (string) responseData["region_name"]; | 283 | regionInfo.RegionName = (string)responseData["region_name"]; |
282 | 284 | ||
283 | m_remoteRegionInfoCache.Add(regionHandle, regionInfo); | 285 | m_remoteRegionInfoCache.Add(regionHandle, regionInfo); |
286 | } | ||
287 | catch (System.Net.WebException) | ||
288 | { | ||
289 | MainLog.Instance.Error("GRID", "Region lookup failed for: " + regionHandle.ToString() + " - Is the GridServer down?"); | ||
290 | return null; | ||
291 | } | ||
284 | } | 292 | } |
285 | 293 | ||
286 | return regionInfo; | 294 | return regionInfo; |
@@ -540,34 +548,33 @@ namespace OpenSim.Region.Communications.OGS1 | |||
540 | } | 548 | } |
541 | 549 | ||
542 | // UGLY! | 550 | // UGLY! |
543 | public bool RegionUp(SearializableRegionInfo region) | 551 | public bool RegionUp(SearializableRegionInfo region, ulong regionhandle) |
544 | { | 552 | { |
545 | 553 | SearializableRegionInfo regInfo = null; | |
546 | // This is stupid. For this to work, when the region registers it must request nearby map blocks. | 554 | try |
547 | // In addition to filling the map blocks, it fills a 'known regions' list. | ||
548 | |||
549 | // This known regions list then gets queried on here to get the remoting data from the neighbors. | ||
550 | // *Pull yourself up by your bootstraps?* | ||
551 | |||
552 | if (m_localBackend.RegionUp(region)) | ||
553 | { | 555 | { |
554 | return true; | 556 | // You may ask why this is in here... |
555 | } | 557 | // The region asking the grid services about itself.. |
556 | 558 | // And, surprisingly, the reason is.. it doesn't know | |
557 | foreach (SimpleRegionInfo knownregion in m_knownRegions) | 559 | // it's own remoting port! How special. |
558 | { | 560 | region = new SearializableRegionInfo(RequestNeighbourInfo(region.RegionHandle)); |
559 | 561 | region.RemotingAddress = region.ExternalHostName; | |
560 | SearializableRegionInfo regInfo = new SearializableRegionInfo(RequestNeighbourInfo(knownregion.RegionID)); | 562 | region.RemotingPort = (uint) NetworkServersInfo.RemotingListenerPort; |
561 | 563 | if (m_localBackend.RegionUp(region,regionhandle)) | |
562 | try | 564 | { |
563 | { | 565 | return true; |
564 | 566 | } | |
565 | if ((!(regInfo.Equals(null)) && regInfo.RemotingAddress.Length > 0)) | 567 | |
568 | regInfo = new SearializableRegionInfo(RequestNeighbourInfo(regionhandle)); | ||
569 | if (regInfo != null) | ||
570 | { | ||
571 | // If we're not trying to remote to ourselves. | ||
572 | if (regInfo.RemotingAddress != region.RemotingAddress && region.RemotingAddress != null) | ||
566 | { | 573 | { |
567 | //don't want to be creating a new link to the remote instance every time like we are here | 574 | //don't want to be creating a new link to the remote instance every time like we are here |
568 | bool retValue = false; | 575 | bool retValue = false; |
569 | 576 | ||
570 | 577 | ||
571 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 578 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( |
572 | typeof(OGS1InterRegionRemoting), | 579 | typeof(OGS1InterRegionRemoting), |
573 | "tcp://" + regInfo.RemotingAddress + | 580 | "tcp://" + regInfo.RemotingAddress + |
@@ -576,49 +583,59 @@ namespace OpenSim.Region.Communications.OGS1 | |||
576 | 583 | ||
577 | if (remObject != null) | 584 | if (remObject != null) |
578 | { | 585 | { |
579 | retValue = remObject.RegionUp(region); | 586 | retValue = remObject.RegionUp(region, regionhandle); |
580 | } | 587 | } |
581 | else | 588 | else |
582 | { | 589 | { |
583 | Console.WriteLine("remoting object not found"); | 590 | Console.WriteLine("remoting object not found"); |
584 | } | 591 | } |
585 | remObject = null; | 592 | remObject = null; |
586 | MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to NotifyRegionUp for " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | 593 | MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to inform region I'm up"); |
587 | 594 | ||
595 | return retValue; | ||
596 | } | ||
597 | else | ||
598 | { | ||
599 | // We're trying to inform ourselves via remoting. | ||
600 | // This is here because we're looping over the listeners before we get here. | ||
601 | // Odd but it should work. | ||
602 | return true; | ||
588 | } | 603 | } |
589 | |||
590 | } | ||
591 | catch (RemotingException e) | ||
592 | { | ||
593 | MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
594 | MainLog.Instance.Debug(e.ToString()); | ||
595 | //return false; | ||
596 | } | ||
597 | catch (SocketException e) | ||
598 | { | ||
599 | MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
600 | MainLog.Instance.Debug(e.ToString()); | ||
601 | //return false; | ||
602 | } | ||
603 | catch (InvalidCredentialException e) | ||
604 | { | ||
605 | MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
606 | MainLog.Instance.Debug(e.ToString()); | ||
607 | //return false; | ||
608 | } | ||
609 | catch (AuthenticationException e) | ||
610 | { | ||
611 | MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
612 | MainLog.Instance.Debug(e.ToString()); | ||
613 | //return false; | ||
614 | } | ||
615 | catch (Exception e) | ||
616 | { | ||
617 | MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
618 | MainLog.Instance.Debug(e.ToString()); | ||
619 | //return false; | ||
620 | } | 604 | } |
605 | |||
606 | return false; | ||
607 | } | ||
608 | catch (RemotingException e) | ||
609 | { | ||
610 | MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
611 | MainLog.Instance.Debug(e.ToString()); | ||
612 | return false; | ||
613 | } | ||
614 | catch (SocketException e) | ||
615 | { | ||
616 | MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
617 | MainLog.Instance.Debug(e.ToString()); | ||
618 | return false; | ||
621 | } | 619 | } |
620 | catch (InvalidCredentialException e) | ||
621 | { | ||
622 | MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
623 | MainLog.Instance.Debug(e.ToString()); | ||
624 | return false; | ||
625 | } | ||
626 | catch (AuthenticationException e) | ||
627 | { | ||
628 | MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
629 | MainLog.Instance.Debug(e.ToString()); | ||
630 | return false; | ||
631 | } | ||
632 | catch (Exception e) | ||
633 | { | ||
634 | MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY); | ||
635 | MainLog.Instance.Debug(e.ToString()); | ||
636 | return false; | ||
637 | } | ||
638 | |||
622 | return true; | 639 | return true; |
623 | } | 640 | } |
624 | /// <summary> | 641 | /// <summary> |
@@ -837,13 +854,13 @@ namespace OpenSim.Region.Communications.OGS1 | |||
837 | } | 854 | } |
838 | } | 855 | } |
839 | 856 | ||
840 | public bool TriggerRegionUp(SearializableRegionInfo regionData) | 857 | public bool TriggerRegionUp(SearializableRegionInfo regionData, ulong regionhandle) |
841 | { | 858 | { |
842 | MainLog.Instance.Verbose("INTER", gdebugRegionName + ": Incoming OGS1 RegionUpReport: " + regionData.RegionLocX + "," + regionData.RegionLocY); | 859 | MainLog.Instance.Verbose("INTER", gdebugRegionName + ": Incoming OGS1 RegionUpReport: " + regionData.RegionLocX + "," + regionData.RegionLocY); |
843 | 860 | ||
844 | try | 861 | try |
845 | { | 862 | { |
846 | return m_localBackend.TriggerRegionUp(new RegionInfo(regionData)); | 863 | return m_localBackend.TriggerRegionUp(new RegionInfo(regionData), regionhandle); |
847 | } | 864 | } |
848 | 865 | ||
849 | catch (RemotingException e) | 866 | catch (RemotingException e) |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs index 2f7e591..d55528c 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs | |||
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
41 | 41 | ||
42 | public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData); | 42 | public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData); |
43 | 43 | ||
44 | public delegate bool RegionUp (SearializableRegionInfo region); | 44 | public delegate bool RegionUp (SearializableRegionInfo region, ulong regionhandle); |
45 | 45 | ||
46 | public sealed class InterRegionSingleton | 46 | public sealed class InterRegionSingleton |
47 | { | 47 | { |
@@ -76,12 +76,12 @@ namespace OpenSim.Region.Communications.OGS1 | |||
76 | return false; | 76 | return false; |
77 | } | 77 | } |
78 | 78 | ||
79 | public bool RegionUp(SearializableRegionInfo sregion) | 79 | public bool RegionUp(SearializableRegionInfo sregion, ulong regionhandle) |
80 | { | 80 | { |
81 | 81 | ||
82 | if (OnRegionUp != null) | 82 | if (OnRegionUp != null) |
83 | { | 83 | { |
84 | return OnRegionUp(sregion); | 84 | return OnRegionUp(sregion, regionhandle); |
85 | } | 85 | } |
86 | return false; | 86 | return false; |
87 | } | 87 | } |
@@ -130,11 +130,11 @@ namespace OpenSim.Region.Communications.OGS1 | |||
130 | return false; | 130 | return false; |
131 | } | 131 | } |
132 | } | 132 | } |
133 | public bool RegionUp(SearializableRegionInfo region) | 133 | public bool RegionUp(SearializableRegionInfo region, ulong regionhandle) |
134 | { | 134 | { |
135 | try | 135 | try |
136 | { | 136 | { |
137 | return InterRegionSingleton.Instance.RegionUp(region); | 137 | return InterRegionSingleton.Instance.RegionUp(region, regionhandle); |
138 | } | 138 | } |
139 | catch (RemotingException e) | 139 | catch (RemotingException e) |
140 | { | 140 | { |
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 | { |