aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid
diff options
context:
space:
mode:
authorMike Mazur2008-10-29 02:27:39 +0000
committerMike Mazur2008-10-29 02:27:39 +0000
commit3fd35f9fbe954d963894ec0de8e60aaa2fd9ffde (patch)
tree8d3794278bae477b065167040238945f88f589f8 /OpenSim/Grid
parentRemove a debug output (diff)
downloadopensim-SC_OLD-3fd35f9fbe954d963894ec0de8e60aaa2fd9ffde.zip
opensim-SC_OLD-3fd35f9fbe954d963894ec0de8e60aaa2fd9ffde.tar.gz
opensim-SC_OLD-3fd35f9fbe954d963894ec0de8e60aaa2fd9ffde.tar.bz2
opensim-SC_OLD-3fd35f9fbe954d963894ec0de8e60aaa2fd9ffde.tar.xz
GridManager.GetRegions() now returns a List, not a Dictionary. Also removed some trailing whitespace.
Diffstat (limited to '')
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs75
1 files changed, 35 insertions, 40 deletions
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 7739a55..0fc2147 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -165,19 +165,15 @@ namespace OpenSim.Grid.GridServer
165 return null; 165 return null;
166 } 166 }
167 167
168 public Dictionary<ulong, RegionProfileData> GetRegions(uint xmin, uint ymin, uint xmax, uint ymax) 168 public List<RegionProfileData> GetRegions(uint xmin, uint ymin, uint xmax, uint ymax)
169 { 169 {
170 Dictionary<ulong, RegionProfileData> regions = new Dictionary<ulong, RegionProfileData>(); 170 List<RegionProfileData> regions = new List<RegionProfileData>();
171 171
172 foreach (IGridDataPlugin plugin in _plugins) 172 foreach (IGridDataPlugin plugin in _plugins)
173 { 173 {
174 try 174 try
175 { 175 {
176 RegionProfileData[] neighbours = plugin.GetProfilesInRange(xmin, ymin, xmax, ymax); 176 regions.AddRange(plugin.GetProfilesInRange(xmin, ymin, xmax, ymax));
177 foreach (RegionProfileData neighbour in neighbours)
178 {
179 regions[neighbour.regionHandle] = neighbour;
180 }
181 } 177 }
182 catch 178 catch
183 { 179 {
@@ -377,15 +373,15 @@ namespace OpenSim.Grid.GridServer
377 m_log.Warn("[LOGIN PRELUDE]: Invalid login parameters, sending back error response."); 373 m_log.Warn("[LOGIN PRELUDE]: Invalid login parameters, sending back error response.");
378 return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString()); 374 return ErrorResponse("Wrong format in login parameters. Please verify parameters." + e.ToString());
379 } 375 }
380 376
381 if (!Config.AllowRegionRegistration) 377 if (!Config.AllowRegionRegistration)
382 { 378 {
383 m_log.InfoFormat( 379 m_log.InfoFormat(
384 "[LOGIN END]: Disabled region registration blocked login request from simulator: {0}", 380 "[LOGIN END]: Disabled region registration blocked login request from simulator: {0}",
385 sim.regionName); 381 sim.regionName);
386 382
387 return ErrorResponse("The grid is currently not accepting region registrations."); 383 return ErrorResponse("The grid is currently not accepting region registrations.");
388 } 384 }
389 385
390 m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName); 386 m_log.InfoFormat("[LOGIN BEGIN]: Received login request from simulator: {0}", sim.regionName);
391 387
@@ -530,21 +526,21 @@ namespace OpenSim.Grid.GridServer
530 Hashtable NeighbourBlock; 526 Hashtable NeighbourBlock;
531 527
532 //First use the fast method. (not implemented in SQLLite) 528 //First use the fast method. (not implemented in SQLLite)
533 Dictionary<ulong, RegionProfileData> neighbours = GetRegions(sim.regionLocX - 1, sim.regionLocY - 1, sim.regionLocX + 1, sim.regionLocY + 1); 529 List<RegionProfileData> neighbours = GetRegions(sim.regionLocX - 1, sim.regionLocY - 1, sim.regionLocX + 1, sim.regionLocY + 1);
534 530
535 if (neighbours.Count > 0) 531 if (neighbours.Count > 0)
536 { 532 {
537 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) 533 foreach (RegionProfileData aSim in neighbours)
538 { 534 {
539 NeighbourBlock = new Hashtable(); 535 NeighbourBlock = new Hashtable();
540 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.Value.serverIP.ToString()).ToString(); 536 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.serverIP.ToString()).ToString();
541 NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString(); 537 NeighbourBlock["sim_port"] = aSim.serverPort.ToString();
542 NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString(); 538 NeighbourBlock["region_locx"] = aSim.regionLocX.ToString();
543 NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString(); 539 NeighbourBlock["region_locy"] = aSim.regionLocY.ToString();
544 NeighbourBlock["UUID"] = aSim.Value.ToString(); 540 NeighbourBlock["UUID"] = aSim.ToString();
545 NeighbourBlock["regionHandle"] = aSim.Value.regionHandle.ToString(); 541 NeighbourBlock["regionHandle"] = aSim.regionHandle.ToString();
546 542
547 if (aSim.Value.UUID != sim.UUID) 543 if (aSim.UUID != sim.UUID)
548 { 544 {
549 SimNeighboursData.Add(NeighbourBlock); 545 SimNeighboursData.Add(NeighbourBlock);
550 } 546 }
@@ -835,29 +831,28 @@ namespace OpenSim.Grid.GridServer
835 831
836 if (fastMode) 832 if (fastMode)
837 { 833 {
838 Dictionary<ulong, RegionProfileData> neighbours = 834 List<RegionProfileData> neighbours = GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax);
839 GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax);
840 835
841 foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) 836 foreach (RegionProfileData aSim in neighbours)
842 { 837 {
843 Hashtable simProfileBlock = new Hashtable(); 838 Hashtable simProfileBlock = new Hashtable();
844 simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); 839 simProfileBlock["x"] = aSim.regionLocX.ToString();
845 simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); 840 simProfileBlock["y"] = aSim.regionLocY.ToString();
846 //m_log.DebugFormat("[MAP]: Sending neighbour info for {0},{1}", aSim.Value.regionLocX, aSim.Value.regionLocY); 841 //m_log.DebugFormat("[MAP]: Sending neighbour info for {0},{1}", aSim.regionLocX, aSim.regionLocY);
847 simProfileBlock["name"] = aSim.Value.regionName; 842 simProfileBlock["name"] = aSim.regionName;
848 simProfileBlock["access"] = 21; 843 simProfileBlock["access"] = 21;
849 simProfileBlock["region-flags"] = 512; 844 simProfileBlock["region-flags"] = 512;
850 simProfileBlock["water-height"] = 0; 845 simProfileBlock["water-height"] = 0;
851 simProfileBlock["agents"] = 1; 846 simProfileBlock["agents"] = 1;
852 simProfileBlock["map-image-id"] = aSim.Value.regionMapTextureID.ToString(); 847 simProfileBlock["map-image-id"] = aSim.regionMapTextureID.ToString();
853 848
854 // For Sugilite compatibility 849 // For Sugilite compatibility
855 simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString(); 850 simProfileBlock["regionhandle"] = aSim.regionHandle.ToString();
856 simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString(); 851 simProfileBlock["sim_ip"] = aSim.serverIP.ToString();
857 simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString(); 852 simProfileBlock["sim_port"] = aSim.serverPort.ToString();
858 simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString(); 853 simProfileBlock["sim_uri"] = aSim.serverURI.ToString();
859 simProfileBlock["uuid"] = aSim.Value.UUID.ToString(); 854 simProfileBlock["uuid"] = aSim.UUID.ToString();
860 simProfileBlock["remoting_port"] = aSim.Value.remotingPort; 855 simProfileBlock["remoting_port"] = aSim.remotingPort;
861 856
862 simProfileList.Add(simProfileBlock); 857 simProfileList.Add(simProfileBlock);
863 } 858 }
@@ -913,15 +908,15 @@ namespace OpenSim.Grid.GridServer
913 public XmlRpcResponse XmlRpcSearchForRegionMethod(XmlRpcRequest request) 908 public XmlRpcResponse XmlRpcSearchForRegionMethod(XmlRpcRequest request)
914 { 909 {
915 Hashtable requestData = (Hashtable)request.Params[0]; 910 Hashtable requestData = (Hashtable)request.Params[0];
916 911
917 if (!requestData.ContainsKey("name") || !requestData.Contains("maxNumber")) 912 if (!requestData.ContainsKey("name") || !requestData.Contains("maxNumber"))
918 { 913 {
919 m_log.Warn("[DATA] Invalid region-search request; missing name or maxNumber"); 914 m_log.Warn("[DATA] Invalid region-search request; missing name or maxNumber");
920 return new XmlRpcResponse(500, "Missing name or maxNumber in region search request"); 915 return new XmlRpcResponse(500, "Missing name or maxNumber in region search request");
921 } 916 }
922 917
923 Hashtable responseData = new Hashtable(); 918 Hashtable responseData = new Hashtable();
924 919
925 string name = (string)requestData["name"]; 920 string name = (string)requestData["name"];
926 int maxNumber = Convert.ToInt32((string)requestData["maxNumber"]); 921 int maxNumber = Convert.ToInt32((string)requestData["maxNumber"]);
927 if (maxNumber == 0 || name.Length < 3) 922 if (maxNumber == 0 || name.Length < 3)
@@ -1215,7 +1210,7 @@ namespace OpenSim.Grid.GridServer
1215 } 1210 }
1216 return response; 1211 return response;
1217 } 1212 }
1218 1213
1219 /// <summary> 1214 /// <summary>
1220 /// Construct an XMLRPC registration disabled response 1215 /// Construct an XMLRPC registration disabled response
1221 /// </summary> 1216 /// </summary>
@@ -1228,7 +1223,7 @@ namespace OpenSim.Grid.GridServer
1228 errorResponse.Value = errorResponseData; 1223 errorResponse.Value = errorResponseData;
1229 errorResponseData["restricted"] = error; 1224 errorResponseData["restricted"] = error;
1230 return errorResponse; 1225 return errorResponse;
1231 } 1226 }
1232 } 1227 }
1233 1228
1234 /// <summary> 1229 /// <summary>