diff options
author | Jeff Ames | 2008-03-18 14:51:42 +0000 |
---|---|---|
committer | Jeff Ames | 2008-03-18 14:51:42 +0000 |
commit | bf8b5844f24d294c459f54147bd511e7112288bf (patch) | |
tree | 1b6a1ba4e9888d43694a8a33c21beb6913ce2d3a /OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |
parent | * Applied Grumly57 patch for #781; Thanks, Grumly! (diff) | |
download | opensim-SC_OLD-bf8b5844f24d294c459f54147bd511e7112288bf.zip opensim-SC_OLD-bf8b5844f24d294c459f54147bd511e7112288bf.tar.gz opensim-SC_OLD-bf8b5844f24d294c459f54147bd511e7112288bf.tar.bz2 opensim-SC_OLD-bf8b5844f24d294c459f54147bd511e7112288bf.tar.xz |
Formatting cleanup. Minor refactoring.
Diffstat (limited to 'OpenSim/Region/Communications/OGS1/OGS1GridServices.cs')
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 190 |
1 files changed, 87 insertions, 103 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index b7fae65..f324886 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -134,7 +134,8 @@ namespace OpenSim.Region.Communications.OGS1 | |||
134 | { | 134 | { |
135 | GridReq = new XmlRpcRequest("simulator_login", SendParams); | 135 | GridReq = new XmlRpcRequest("simulator_login", SendParams); |
136 | GridResp = GridReq.Send(serversInfo.GridURL, 16000); | 136 | GridResp = GridReq.Send(serversInfo.GridURL, 16000); |
137 | } catch (Exception ex) | 137 | } |
138 | catch (Exception ex) | ||
138 | { | 139 | { |
139 | m_log.Error("Unable to connect to grid. Grid server not running?"); | 140 | m_log.Error("Unable to connect to grid. Grid server not running?"); |
140 | throw(ex); | 141 | throw(ex); |
@@ -182,7 +183,8 @@ namespace OpenSim.Region.Communications.OGS1 | |||
182 | Hashtable griddatahash = GridRespData; | 183 | Hashtable griddatahash = GridRespData; |
183 | 184 | ||
184 | // Process Response | 185 | // Process Response |
185 | if (GridRespData.ContainsKey("error")) { | 186 | if (GridRespData.ContainsKey("error")) |
187 | { | ||
186 | string errorstring = (string)GridRespData["error"]; | 188 | string errorstring = (string)GridRespData["error"]; |
187 | m_log.Error("Unable to connect to grid: " + errorstring); | 189 | m_log.Error("Unable to connect to grid: " + errorstring); |
188 | return false; | 190 | return false; |
@@ -202,7 +204,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
202 | returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]); | 204 | returnGridSettings.Add(Dictkey, m_queuedGridSettings[Dictkey]); |
203 | } | 205 | } |
204 | 206 | ||
205 | |||
206 | m_queuedGridSettings.Clear(); | 207 | m_queuedGridSettings.Clear(); |
207 | } | 208 | } |
208 | 209 | ||
@@ -308,10 +309,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
308 | return regionInfo; | 309 | return regionInfo; |
309 | } | 310 | } |
310 | 311 | ||
311 | if (m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo)) | 312 | if (!m_remoteRegionInfoCache.TryGetValue(regionHandle, out regionInfo)) |
312 | { | ||
313 | } | ||
314 | else | ||
315 | { | 313 | { |
316 | try | 314 | try |
317 | { | 315 | { |
@@ -366,54 +364,51 @@ namespace OpenSim.Region.Communications.OGS1 | |||
366 | // Don't use this method. It's only for SLURLS and Logins | 364 | // Don't use this method. It's only for SLURLS and Logins |
367 | RegionInfo regionInfo = null; | 365 | RegionInfo regionInfo = null; |
368 | try | 366 | try |
369 | { | 367 | { |
370 | Hashtable requestData = new Hashtable(); | 368 | Hashtable requestData = new Hashtable(); |
371 | requestData["region_name_search"] = regionName; | 369 | requestData["region_name_search"] = regionName; |
372 | requestData["authkey"] = serversInfo.GridSendKey; | 370 | requestData["authkey"] = serversInfo.GridSendKey; |
373 | ArrayList SendParams = new ArrayList(); | 371 | ArrayList SendParams = new ArrayList(); |
374 | SendParams.Add(requestData); | 372 | SendParams.Add(requestData); |
375 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); | 373 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams); |
376 | XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); | 374 | XmlRpcResponse GridResp = GridReq.Send(serversInfo.GridURL, 3000); |
377 | 375 | ||
378 | Hashtable responseData = (Hashtable) GridResp.Value; | 376 | Hashtable responseData = (Hashtable) GridResp.Value; |
379 | 377 | ||
380 | if (responseData.ContainsKey("error")) | 378 | if (responseData.ContainsKey("error")) |
381 | { | 379 | { |
382 | m_log.Error("[OGS1 GRID SERVICES]: Error received from grid server" + responseData["error"]); | 380 | m_log.Error("[OGS1 GRID SERVICES]: Error received from grid server" + responseData["error"]); |
383 | return null; | 381 | return null; |
384 | } | 382 | } |
385 | 383 | ||
386 | uint regX = Convert.ToUInt32((string) responseData["region_locx"]); | 384 | uint regX = Convert.ToUInt32((string) responseData["region_locx"]); |
387 | uint regY = Convert.ToUInt32((string) responseData["region_locy"]); | 385 | uint regY = Convert.ToUInt32((string) responseData["region_locy"]); |
388 | string internalIpStr = (string) responseData["sim_ip"]; | 386 | string internalIpStr = (string) responseData["sim_ip"]; |
389 | uint port = Convert.ToUInt32(responseData["sim_port"]); | 387 | uint port = Convert.ToUInt32(responseData["sim_port"]); |
390 | string externalUri = (string) responseData["sim_uri"]; | 388 | string externalUri = (string) responseData["sim_uri"]; |
391 | 389 | ||
392 | IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); | 390 | IPEndPoint neighbourInternalEndPoint = new IPEndPoint(IPAddress.Parse(internalIpStr), (int) port); |
393 | string neighbourExternalUri = externalUri; | 391 | string neighbourExternalUri = externalUri; |
394 | regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); | 392 | regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, internalIpStr); |
395 | 393 | ||
396 | regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); | 394 | regionInfo.RemotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); |
397 | regionInfo.RemotingAddress = internalIpStr; | 395 | regionInfo.RemotingAddress = internalIpStr; |
398 | 396 | ||
399 | regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); | 397 | regionInfo.RegionID = new LLUUID((string) responseData["region_UUID"]); |
400 | regionInfo.RegionName = (string) responseData["region_name"]; | 398 | regionInfo.RegionName = (string) responseData["region_name"]; |
401 | 399 | ||
402 | m_remoteRegionInfoCache.Add(regionInfo.RegionHandle, regionInfo); | 400 | m_remoteRegionInfoCache.Add(regionInfo.RegionHandle, regionInfo); |
403 | } | 401 | } |
404 | catch (WebException) | 402 | catch (WebException) |
405 | { | 403 | { |
406 | m_log.Error("[OGS1 GRID SERVICES]: " + | 404 | m_log.Error("[OGS1 GRID SERVICES]: " + |
407 | "Region lookup failed for: " + regionName + | 405 | "Region lookup failed for: " + regionName + |
408 | " - Is the GridServer down?"); | 406 | " - Is the GridServer down?"); |
409 | } | 407 | } |
410 | |||
411 | 408 | ||
412 | return regionInfo; | 409 | return regionInfo; |
413 | |||
414 | } | 410 | } |
415 | 411 | ||
416 | |||
417 | /// <summary> | 412 | /// <summary> |
418 | /// | 413 | /// |
419 | /// </summary> | 414 | /// </summary> |
@@ -465,9 +460,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
465 | return neighbours; | 460 | return neighbours; |
466 | } | 461 | } |
467 | 462 | ||
468 | |||
469 | |||
470 | |||
471 | /// <summary> | 463 | /// <summary> |
472 | /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates | 464 | /// Performs a XML-RPC query against the grid server returning mapblock information in the specified coordinates |
473 | /// </summary> | 465 | /// </summary> |
@@ -519,7 +511,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
519 | return response; | 511 | return response; |
520 | } | 512 | } |
521 | 513 | ||
522 | |||
523 | // Grid Request Processing | 514 | // Grid Request Processing |
524 | /// <summary> | 515 | /// <summary> |
525 | /// Received from the user server when a user starts logging in. This call allows | 516 | /// Received from the user server when a user starts logging in. This call allows |
@@ -596,7 +587,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
596 | InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; | 587 | InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; |
597 | InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate; | 588 | InterRegionSingleton.Instance.OnChildAgentUpdate += TriggerChildAgentUpdate; |
598 | InterRegionSingleton.Instance.OnTellRegionToCloseChildConnection += TriggerTellRegionToCloseChildConnection; | 589 | InterRegionSingleton.Instance.OnTellRegionToCloseChildConnection += TriggerTellRegionToCloseChildConnection; |
599 | |||
600 | } | 590 | } |
601 | 591 | ||
602 | #region Methods called by regions in this instance | 592 | #region Methods called by regions in this instance |
@@ -629,10 +619,10 @@ namespace OpenSim.Region.Communications.OGS1 | |||
629 | 619 | ||
630 | 620 | ||
631 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 621 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( |
632 | typeof(OGS1InterRegionRemoting), | 622 | typeof(OGS1InterRegionRemoting), |
633 | "tcp://" + regInfo.RemotingAddress + | 623 | "tcp://" + regInfo.RemotingAddress + |
634 | ":" + regInfo.RemotingPort + | 624 | ":" + regInfo.RemotingPort + |
635 | "/InterRegions"); | 625 | "/InterRegions"); |
636 | 626 | ||
637 | if (remObject != null) | 627 | if (remObject != null) |
638 | { | 628 | { |
@@ -738,29 +728,27 @@ namespace OpenSim.Region.Communications.OGS1 | |||
738 | //don't want to be creating a new link to the remote instance every time like we are here | 728 | //don't want to be creating a new link to the remote instance every time like we are here |
739 | bool retValue = false; | 729 | bool retValue = false; |
740 | 730 | ||
731 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | ||
732 | typeof(OGS1InterRegionRemoting), | ||
733 | "tcp://" + regInfo.RemotingAddress + | ||
734 | ":" + regInfo.RemotingPort + | ||
735 | "/InterRegions"); | ||
741 | 736 | ||
742 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 737 | if (remObject != null) |
743 | typeof(OGS1InterRegionRemoting), | 738 | { |
744 | "tcp://" + regInfo.RemotingAddress + | 739 | retValue = remObject.InformRegionOfChildAgent(regionHandle, new sAgentCircuitData(agentData)); |
745 | ":" + regInfo.RemotingPort + | 740 | } |
746 | "/InterRegions"); | 741 | else |
747 | 742 | { | |
748 | if (remObject != null) | 743 | m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found"); |
749 | { | 744 | } |
750 | retValue = remObject.InformRegionOfChildAgent(regionHandle, new sAgentCircuitData(agentData)); | 745 | remObject = null; |
751 | } | 746 | m_log.Info("[OGS1 GRID SERVICES]: " + |
752 | else | 747 | gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + |
753 | { | 748 | agentData.firstname + " " + agentData.lastname + " and got " + |
754 | m_log.Warn("[OGS1 GRID SERVICES]: remoting object not found"); | 749 | retValue.ToString()); |
755 | } | ||
756 | remObject = null; | ||
757 | m_log.Info("[OGS1 GRID SERVICES]: " + | ||
758 | gdebugRegionName + ": OGS1 tried to InformRegionOfChildAgent for " + | ||
759 | agentData.firstname + " " + agentData.lastname + " and got " + | ||
760 | retValue.ToString()); | ||
761 | |||
762 | return retValue; | ||
763 | 750 | ||
751 | return retValue; | ||
764 | } | 752 | } |
765 | NoteDeadRegion(regionHandle); | 753 | NoteDeadRegion(regionHandle); |
766 | return false; | 754 | return false; |
@@ -849,14 +837,12 @@ namespace OpenSim.Region.Communications.OGS1 | |||
849 | //don't want to be creating a new link to the remote instance every time like we are here | 837 | //don't want to be creating a new link to the remote instance every time like we are here |
850 | bool retValue = false; | 838 | bool retValue = false; |
851 | 839 | ||
852 | |||
853 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( | 840 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( |
854 | typeof ( | 841 | typeof(OGS1InterRegionRemoting), |
855 | OGS1InterRegionRemoting), | 842 | "tcp://" + |
856 | "tcp://" + | 843 | regInfo.RemotingAddress + |
857 | regInfo.RemotingAddress + | 844 | ":" + regInfo.RemotingPort + |
858 | ":" + regInfo.RemotingPort + | 845 | "/InterRegions"); |
859 | "/InterRegions"); | ||
860 | 846 | ||
861 | if (remObject != null) | 847 | if (remObject != null) |
862 | { | 848 | { |
@@ -939,7 +925,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
939 | /// <returns></returns> | 925 | /// <returns></returns> |
940 | public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData) | 926 | public bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData) |
941 | { | 927 | { |
942 | int failures = 0; | 928 | int failures = 0; |
943 | lock (m_deadRegionCache) | 929 | lock (m_deadRegionCache) |
944 | { | 930 | { |
945 | if (m_deadRegionCache.ContainsKey(regionHandle)) | 931 | if (m_deadRegionCache.ContainsKey(regionHandle)) |
@@ -963,12 +949,11 @@ namespace OpenSim.Region.Communications.OGS1 | |||
963 | //don't want to be creating a new link to the remote instance every time like we are here | 949 | //don't want to be creating a new link to the remote instance every time like we are here |
964 | bool retValue = false; | 950 | bool retValue = false; |
965 | 951 | ||
966 | |||
967 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 952 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( |
968 | typeof(OGS1InterRegionRemoting), | 953 | typeof(OGS1InterRegionRemoting), |
969 | "tcp://" + regInfo.RemotingAddress + | 954 | "tcp://" + regInfo.RemotingAddress + |
970 | ":" + regInfo.RemotingPort + | 955 | ":" + regInfo.RemotingPort + |
971 | "/InterRegions"); | 956 | "/InterRegions"); |
972 | 957 | ||
973 | if (remObject != null) | 958 | if (remObject != null) |
974 | { | 959 | { |
@@ -980,7 +965,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
980 | } | 965 | } |
981 | remObject = null; | 966 | remObject = null; |
982 | 967 | ||
983 | |||
984 | return retValue; | 968 | return retValue; |
985 | } | 969 | } |
986 | NoteDeadRegion(regionHandle); | 970 | NoteDeadRegion(regionHandle); |
@@ -1050,10 +1034,11 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1050 | { | 1034 | { |
1051 | bool retValue = false; | 1035 | bool retValue = false; |
1052 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( | 1036 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( |
1053 | typeof (OGS1InterRegionRemoting), | 1037 | typeof (OGS1InterRegionRemoting), |
1054 | "tcp://" + regInfo.RemotingAddress + | 1038 | "tcp://" + regInfo.RemotingAddress + |
1055 | ":" + regInfo.RemotingPort + | 1039 | ":" + regInfo.RemotingPort + |
1056 | "/InterRegions"); | 1040 | "/InterRegions"); |
1041 | |||
1057 | if (remObject != null) | 1042 | if (remObject != null) |
1058 | { | 1043 | { |
1059 | retValue = | 1044 | retValue = |
@@ -1106,10 +1091,11 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1106 | { | 1091 | { |
1107 | bool retValue = false; | 1092 | bool retValue = false; |
1108 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( | 1093 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting) Activator.GetObject( |
1109 | typeof (OGS1InterRegionRemoting), | 1094 | typeof (OGS1InterRegionRemoting), |
1110 | "tcp://" + regInfo.RemotingAddress + | 1095 | "tcp://" + regInfo.RemotingAddress + |
1111 | ":" + regInfo.RemotingPort + | 1096 | ":" + regInfo.RemotingPort + |
1112 | "/InterRegions"); | 1097 | "/InterRegions"); |
1098 | |||
1113 | if (remObject != null) | 1099 | if (remObject != null) |
1114 | { | 1100 | { |
1115 | retValue = | 1101 | retValue = |
@@ -1181,10 +1167,11 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1181 | { | 1167 | { |
1182 | bool retValue = false; | 1168 | bool retValue = false; |
1183 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( | 1169 | OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( |
1184 | typeof(OGS1InterRegionRemoting), | 1170 | typeof(OGS1InterRegionRemoting), |
1185 | "tcp://" + regInfo.RemotingAddress + | 1171 | "tcp://" + regInfo.RemotingAddress + |
1186 | ":" + regInfo.RemotingPort + | 1172 | ":" + regInfo.RemotingPort + |
1187 | "/InterRegions"); | 1173 | "/InterRegions"); |
1174 | |||
1188 | if (remObject != null) | 1175 | if (remObject != null) |
1189 | { | 1176 | { |
1190 | retValue = | 1177 | retValue = |
@@ -1211,7 +1198,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1211 | //m_log.Debug(e.ToString()); | 1198 | //m_log.Debug(e.ToString()); |
1212 | return false; | 1199 | return false; |
1213 | } | 1200 | } |
1214 | |||
1215 | catch (SocketException e) | 1201 | catch (SocketException e) |
1216 | { | 1202 | { |
1217 | NoteDeadRegion(regionHandle); | 1203 | NoteDeadRegion(regionHandle); |
@@ -1312,7 +1298,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1312 | { | 1298 | { |
1313 | if (m_deadRegionCache.ContainsKey(regionData.RegionHandle)) | 1299 | if (m_deadRegionCache.ContainsKey(regionData.RegionHandle)) |
1314 | { | 1300 | { |
1315 | |||
1316 | m_deadRegionCache.Remove(regionData.RegionHandle); | 1301 | m_deadRegionCache.Remove(regionData.RegionHandle); |
1317 | } | 1302 | } |
1318 | } | 1303 | } |
@@ -1356,7 +1341,6 @@ namespace OpenSim.Region.Communications.OGS1 | |||
1356 | m_localBackend.TriggerExpectPrim(regionHandle, primID, objData); | 1341 | m_localBackend.TriggerExpectPrim(regionHandle, primID, objData); |
1357 | return true; | 1342 | return true; |
1358 | //m_localBackend. | 1343 | //m_localBackend. |
1359 | |||
1360 | } | 1344 | } |
1361 | catch (RemotingException e) | 1345 | catch (RemotingException e) |
1362 | { | 1346 | { |