diff options
-rw-r--r-- | OpenSim/Grid/GridServer/GridManager.cs | 69 | ||||
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | 2 |
2 files changed, 49 insertions, 22 deletions
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs index f375a89..e9027ba 100644 --- a/OpenSim/Grid/GridServer/GridManager.cs +++ b/OpenSim/Grid/GridServer/GridManager.cs | |||
@@ -127,7 +127,7 @@ namespace OpenSim.Grid.GridServer | |||
127 | /// </summary> | 127 | /// </summary> |
128 | /// <param name="uuid">A UUID key of the region to return</param> | 128 | /// <param name="uuid">A UUID key of the region to return</param> |
129 | /// <returns>A SimProfileData for the region</returns> | 129 | /// <returns>A SimProfileData for the region</returns> |
130 | public RegionProfileData getRegion(LLUUID uuid) | 130 | public RegionProfileData GetRegion(LLUUID uuid) |
131 | { | 131 | { |
132 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | 132 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) |
133 | { | 133 | { |
@@ -137,7 +137,7 @@ namespace OpenSim.Grid.GridServer | |||
137 | } | 137 | } |
138 | catch (Exception e) | 138 | catch (Exception e) |
139 | { | 139 | { |
140 | m_log.Warn("[storage]: getRegion - " + e.Message); | 140 | m_log.Warn("[storage]: GetRegion - " + e.Message); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | return null; | 143 | return null; |
@@ -148,7 +148,7 @@ namespace OpenSim.Grid.GridServer | |||
148 | /// </summary> | 148 | /// </summary> |
149 | /// <param name="uuid">A regionHandle of the region to return</param> | 149 | /// <param name="uuid">A regionHandle of the region to return</param> |
150 | /// <returns>A SimProfileData for the region</returns> | 150 | /// <returns>A SimProfileData for the region</returns> |
151 | public RegionProfileData getRegion(ulong handle) | 151 | public RegionProfileData GetRegion(ulong handle) |
152 | { | 152 | { |
153 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | 153 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) |
154 | { | 154 | { |
@@ -169,7 +169,7 @@ namespace OpenSim.Grid.GridServer | |||
169 | /// </summary> | 169 | /// </summary> |
170 | /// <param name="regionName">A partial regionName of the region to return</param> | 170 | /// <param name="regionName">A partial regionName of the region to return</param> |
171 | /// <returns>A SimProfileData for the region</returns> | 171 | /// <returns>A SimProfileData for the region</returns> |
172 | public RegionProfileData getRegion(string regionName) | 172 | public RegionProfileData GetRegion(string regionName) |
173 | { | 173 | { |
174 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) | 174 | foreach (KeyValuePair<string, IGridData> kvp in _plugins) |
175 | { | 175 | { |
@@ -185,7 +185,7 @@ namespace OpenSim.Grid.GridServer | |||
185 | return null; | 185 | return null; |
186 | } | 186 | } |
187 | 187 | ||
188 | public Dictionary<ulong, RegionProfileData> getRegions(uint xmin, uint ymin, uint xmax, uint ymax) | 188 | public Dictionary<ulong, RegionProfileData> GetRegions(uint xmin, uint ymin, uint xmax, uint ymax) |
189 | { | 189 | { |
190 | Dictionary<ulong, RegionProfileData> regions = new Dictionary<ulong, RegionProfileData>(); | 190 | Dictionary<ulong, RegionProfileData> regions = new Dictionary<ulong, RegionProfileData>(); |
191 | 191 | ||
@@ -216,19 +216,19 @@ namespace OpenSim.Grid.GridServer | |||
216 | public string GetXMLNeighbours(ulong reqhandle) | 216 | public string GetXMLNeighbours(ulong reqhandle) |
217 | { | 217 | { |
218 | string response = String.Empty; | 218 | string response = String.Empty; |
219 | RegionProfileData central_region = getRegion(reqhandle); | 219 | RegionProfileData central_region = GetRegion(reqhandle); |
220 | RegionProfileData neighbour; | 220 | RegionProfileData neighbour; |
221 | for (int x = -1; x < 2; x++) | 221 | for (int x = -1; x < 2; x++) |
222 | { | 222 | { |
223 | for (int y = -1; y < 2; y++) | 223 | for (int y = -1; y < 2; y++) |
224 | { | 224 | { |
225 | if ( | 225 | if ( |
226 | getRegion( | 226 | GetRegion( |
227 | Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), | 227 | Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), |
228 | (uint)(central_region.regionLocY + y) * Constants.RegionSize)) != null) | 228 | (uint)(central_region.regionLocY + y) * Constants.RegionSize)) != null) |
229 | { | 229 | { |
230 | neighbour = | 230 | neighbour = |
231 | getRegion( | 231 | GetRegion( |
232 | Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), | 232 | Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize), |
233 | (uint)(central_region.regionLocY + y) * Constants.RegionSize)); | 233 | (uint)(central_region.regionLocY + y) * Constants.RegionSize)); |
234 | 234 | ||
@@ -245,12 +245,29 @@ namespace OpenSim.Grid.GridServer | |||
245 | return response; | 245 | return response; |
246 | } | 246 | } |
247 | 247 | ||
248 | /// <summary> | ||
249 | /// Checks that it's valid to replace the existing region data with new data | ||
250 | /// | ||
251 | /// Currently, this means ensure that the keys passed in by the new region | ||
252 | /// match those in the original region. (XXX Is this correct? Shouldn't we simply check | ||
253 | /// against the keys in the current configuration?) | ||
254 | /// </summary> | ||
255 | /// <param name="sim"></param> | ||
256 | /// <returns></returns> | ||
248 | protected virtual bool ValidateOverwrite(RegionProfileData sim, RegionProfileData existingSim) | 257 | protected virtual bool ValidateOverwrite(RegionProfileData sim, RegionProfileData existingSim) |
249 | { | 258 | { |
250 | return (existingSim.regionRecvKey == sim.regionRecvKey && | 259 | return (existingSim.regionRecvKey == sim.regionRecvKey && |
251 | existingSim.regionSendKey == sim.regionSendKey); | 260 | existingSim.regionSendKey == sim.regionSendKey); |
252 | } | 261 | } |
253 | 262 | ||
263 | /// <summary> | ||
264 | /// Checks that the new region data is valid. | ||
265 | /// | ||
266 | /// Currently, this means checking that the keys passed in by the new region | ||
267 | /// match those in the grid server's configuration. | ||
268 | /// </summary> | ||
269 | /// <param name="sim"></param> | ||
270 | /// <returns></returns> | ||
254 | protected virtual bool ValidateNewRegion(RegionProfileData sim) | 271 | protected virtual bool ValidateNewRegion(RegionProfileData sim) |
255 | { | 272 | { |
256 | return (sim.regionRecvKey == Config.SimSendKey && | 273 | return (sim.regionRecvKey == Config.SimSendKey && |
@@ -295,7 +312,7 @@ namespace OpenSim.Grid.GridServer | |||
295 | return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString() ); | 312 | return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString() ); |
296 | } | 313 | } |
297 | 314 | ||
298 | existingSim = getRegion(sim.regionHandle); | 315 | existingSim = GetRegion(sim.regionHandle); |
299 | 316 | ||
300 | if (existingSim == null || existingSim.UUID == sim.UUID || sim.UUID != sim.originUUID) | 317 | if (existingSim == null || existingSim.UUID == sim.UUID || sim.UUID != sim.originUUID) |
301 | { | 318 | { |
@@ -373,6 +390,11 @@ namespace OpenSim.Grid.GridServer | |||
373 | } | 390 | } |
374 | } | 391 | } |
375 | 392 | ||
393 | /// <summary> | ||
394 | /// Construct a successful response to a simulator's login attempt. | ||
395 | /// </summary> | ||
396 | /// <param name="sim"></param> | ||
397 | /// <returns></returns> | ||
376 | private XmlRpcResponse CreateLoginResponse(RegionProfileData sim) | 398 | private XmlRpcResponse CreateLoginResponse(RegionProfileData sim) |
377 | { | 399 | { |
378 | XmlRpcResponse response = new XmlRpcResponse(); | 400 | XmlRpcResponse response = new XmlRpcResponse(); |
@@ -432,7 +454,7 @@ namespace OpenSim.Grid.GridServer | |||
432 | if (fastMode) | 454 | if (fastMode) |
433 | { | 455 | { |
434 | Dictionary<ulong, RegionProfileData> neighbours = | 456 | Dictionary<ulong, RegionProfileData> neighbours = |
435 | getRegions(sim.regionLocX - 1, sim.regionLocY - 1, sim.regionLocX + 1, | 457 | GetRegions(sim.regionLocX - 1, sim.regionLocY - 1, sim.regionLocX + 1, |
436 | sim.regionLocY + 1); | 458 | sim.regionLocY + 1); |
437 | 459 | ||
438 | foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) | 460 | foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) |
@@ -458,12 +480,12 @@ namespace OpenSim.Grid.GridServer | |||
458 | for (int y = -1; y < 2; y++) | 480 | for (int y = -1; y < 2; y++) |
459 | { | 481 | { |
460 | if ( | 482 | if ( |
461 | getRegion( | 483 | GetRegion( |
462 | Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), | 484 | Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), |
463 | (uint)(sim.regionLocY + y) * Constants.RegionSize)) != null) | 485 | (uint)(sim.regionLocY + y) * Constants.RegionSize)) != null) |
464 | { | 486 | { |
465 | neighbour = | 487 | neighbour = |
466 | getRegion( | 488 | GetRegion( |
467 | Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), | 489 | Helpers.UIntsToLong((uint)((sim.regionLocX + x) * Constants.RegionSize), |
468 | (uint)(sim.regionLocY + y) * Constants.RegionSize)); | 490 | (uint)(sim.regionLocY + y) * Constants.RegionSize)); |
469 | 491 | ||
@@ -483,6 +505,11 @@ namespace OpenSim.Grid.GridServer | |||
483 | return SimNeighboursData; | 505 | return SimNeighboursData; |
484 | } | 506 | } |
485 | 507 | ||
508 | /// <summary> | ||
509 | /// Loads the grid's own RegionProfileData object with data from the XMLRPC simulator_login request from a region | ||
510 | /// </summary> | ||
511 | /// <param name="requestData"></param> | ||
512 | /// <returns></returns> | ||
486 | private RegionProfileData RegionFromRequest(Hashtable requestData) | 513 | private RegionProfileData RegionFromRequest(Hashtable requestData) |
487 | { | 514 | { |
488 | RegionProfileData sim; | 515 | RegionProfileData sim; |
@@ -562,7 +589,7 @@ namespace OpenSim.Grid.GridServer | |||
562 | 589 | ||
563 | if (requestData.ContainsKey("UUID")) | 590 | if (requestData.ContainsKey("UUID")) |
564 | { | 591 | { |
565 | //TheSim = getRegion(new LLUUID((string) requestData["UUID"])); | 592 | //TheSim = GetRegion(new LLUUID((string) requestData["UUID"])); |
566 | uuid = requestData["UUID"].ToString(); | 593 | uuid = requestData["UUID"].ToString(); |
567 | Console.WriteLine("deleting region " + uuid); | 594 | Console.WriteLine("deleting region " + uuid); |
568 | // logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcDeleteRegionMethod","", 5,"Attempting delete with UUID."); | 595 | // logToDB((new LLUUID((string)requestData["UUID"])).ToString(),"XmlRpcDeleteRegionMethod","", 5,"Attempting delete with UUID."); |
@@ -623,17 +650,17 @@ namespace OpenSim.Grid.GridServer | |||
623 | RegionProfileData simData = null; | 650 | RegionProfileData simData = null; |
624 | if (requestData.ContainsKey("region_UUID")) | 651 | if (requestData.ContainsKey("region_UUID")) |
625 | { | 652 | { |
626 | simData = getRegion(new LLUUID((string)requestData["region_UUID"])); | 653 | simData = GetRegion(new LLUUID((string)requestData["region_UUID"])); |
627 | } | 654 | } |
628 | else if (requestData.ContainsKey("region_handle")) | 655 | else if (requestData.ContainsKey("region_handle")) |
629 | { | 656 | { |
630 | //CFK: The if/else below this makes this message redundant. | 657 | //CFK: The if/else below this makes this message redundant. |
631 | //CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]); | 658 | //CFK: Console.WriteLine("requesting data for region " + (string) requestData["region_handle"]); |
632 | simData = getRegion(Convert.ToUInt64((string)requestData["region_handle"])); | 659 | simData = GetRegion(Convert.ToUInt64((string)requestData["region_handle"])); |
633 | } | 660 | } |
634 | else if (requestData.ContainsKey("region_name_search")) | 661 | else if (requestData.ContainsKey("region_name_search")) |
635 | { | 662 | { |
636 | simData = getRegion((string)requestData["region_name_search"]); | 663 | simData = GetRegion((string)requestData["region_name_search"]); |
637 | } | 664 | } |
638 | 665 | ||
639 | if (simData == null) | 666 | if (simData == null) |
@@ -698,7 +725,7 @@ namespace OpenSim.Grid.GridServer | |||
698 | if (fastMode) | 725 | if (fastMode) |
699 | { | 726 | { |
700 | Dictionary<ulong, RegionProfileData> neighbours = | 727 | Dictionary<ulong, RegionProfileData> neighbours = |
701 | getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); | 728 | GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax); |
702 | 729 | ||
703 | foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) | 730 | foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) |
704 | { | 731 | { |
@@ -735,7 +762,7 @@ namespace OpenSim.Grid.GridServer | |||
735 | for (int y = ymin; y < ymax + 1; y++) | 762 | for (int y = ymin; y < ymax + 1; y++) |
736 | { | 763 | { |
737 | ulong regHandle = Helpers.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize)); | 764 | ulong regHandle = Helpers.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize)); |
738 | simProfile = getRegion(regHandle); | 765 | simProfile = GetRegion(regHandle); |
739 | if (simProfile != null) | 766 | if (simProfile != null) |
740 | { | 767 | { |
741 | Hashtable simProfileBlock = new Hashtable(); | 768 | Hashtable simProfileBlock = new Hashtable(); |
@@ -808,7 +835,7 @@ namespace OpenSim.Grid.GridServer | |||
808 | LLUUID UUID; | 835 | LLUUID UUID; |
809 | if (LLUUID.TryParse(param, out UUID)) | 836 | if (LLUUID.TryParse(param, out UUID)) |
810 | { | 837 | { |
811 | TheSim = getRegion(UUID); | 838 | TheSim = GetRegion(UUID); |
812 | 839 | ||
813 | if (!(TheSim == null)) | 840 | if (!(TheSim == null)) |
814 | { | 841 | { |
@@ -848,7 +875,7 @@ namespace OpenSim.Grid.GridServer | |||
848 | { | 875 | { |
849 | Console.WriteLine("Processing region update via REST method"); | 876 | Console.WriteLine("Processing region update via REST method"); |
850 | RegionProfileData theSim; | 877 | RegionProfileData theSim; |
851 | theSim = getRegion(new LLUUID(param)); | 878 | theSim = GetRegion(new LLUUID(param)); |
852 | if (theSim == null) | 879 | if (theSim == null) |
853 | { | 880 | { |
854 | theSim = new RegionProfileData(); | 881 | theSim = new RegionProfileData(); |
@@ -959,7 +986,7 @@ namespace OpenSim.Grid.GridServer | |||
959 | } | 986 | } |
960 | catch (Exception e) | 987 | catch (Exception e) |
961 | { | 988 | { |
962 | m_log.Warn("[GRID]: getRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + | 989 | m_log.Warn("[GRID]: GetRegionPlugin Handle " + kvp.Key + " unable to add new sim: " + |
963 | e.ToString()); | 990 | e.ToString()); |
964 | } | 991 | } |
965 | } | 992 | } |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index cf1ead1..d19752c 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -132,7 +132,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
132 | try | 132 | try |
133 | { | 133 | { |
134 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); | 134 | XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams); |
135 | GridResp = GridReq.Send(serversInfo.GridURL, 16000); | 135 | GridResp = GridReq.Send(serversInfo.GridURL, 30000); |
136 | } | 136 | } |
137 | catch (Exception ex) | 137 | catch (Exception ex) |
138 | { | 138 | { |