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/Communications/OGS1 | |
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 '')
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 183 | ||||
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs | 10 |
2 files changed, 105 insertions, 88 deletions
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 | { |