aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/IRegionData.cs11
-rw-r--r--OpenSim/Data/MSSQL/MSSQLRegionData.cs10
-rw-r--r--OpenSim/Data/MySQL/MySQLRegionData.cs26
-rw-r--r--OpenSim/Data/MySQL/Resources/005_GridStore.sql6
-rw-r--r--OpenSim/Data/Null/NullRegionData.cs10
-rw-r--r--OpenSim/Data/RegionProfileData.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs14
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs16
-rw-r--r--OpenSim/Services/Connectors/Grid/GridServiceConnector.cs14
-rw-r--r--OpenSim/Services/GridService/GridService.cs69
-rw-r--r--OpenSim/Services/Interfaces/IGridService.cs4
11 files changed, 180 insertions, 1 deletions
diff --git a/OpenSim/Data/IRegionData.cs b/OpenSim/Data/IRegionData.cs
index 7a607ab..b8de1d8 100644
--- a/OpenSim/Data/IRegionData.cs
+++ b/OpenSim/Data/IRegionData.cs
@@ -60,5 +60,16 @@ namespace OpenSim.Data
60 60
61 bool Delete(UUID regionID); 61 bool Delete(UUID regionID);
62 62
63 List<RegionData> GetDefaultRegions(UUID scopeID);
64 List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y);
65 }
66
67 [Flags]
68 public enum RegionFlags : int
69 {
70 DefaultRegion = 1, // Used for new Rez. Random if multiple defined
71 FallbackRegion = 2, // Regions we redirect to when the destination is down
72 RegionOnline = 4, // Set when a region comes online, unset when it unregisters and DeleteOnUnregister is false
73 NoDirectLogin = 8 // Region unavailable for direct logins (by name)
63 } 74 }
64} 75}
diff --git a/OpenSim/Data/MSSQL/MSSQLRegionData.cs b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
index a898aab..fbfb78e 100644
--- a/OpenSim/Data/MSSQL/MSSQLRegionData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLRegionData.cs
@@ -307,5 +307,15 @@ namespace OpenSim.Data.MSSQL
307 } 307 }
308 return false; 308 return false;
309 } 309 }
310
311 public List<RegionData> GetDefaultRegions(UUID scopeID)
312 {
313 return null;
314 }
315
316 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
317 {
318 return null;
319 }
310 } 320 }
311} 321}
diff --git a/OpenSim/Data/MySQL/MySQLRegionData.cs b/OpenSim/Data/MySQL/MySQLRegionData.cs
index b0075e8..d045f61 100644
--- a/OpenSim/Data/MySQL/MySQLRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLRegionData.cs
@@ -274,5 +274,31 @@ namespace OpenSim.Data.MySQL
274 274
275 return false; 275 return false;
276 } 276 }
277 public List<RegionData> GetDefaultRegions(UUID scopeID)
278 {
279 string command = "select * from `"+m_Realm+"` where (flags & 1) <> 0";
280 if (scopeID != UUID.Zero)
281 command += " and ScopeID = ?scopeID";
282
283 MySqlCommand cmd = new MySqlCommand(command);
284
285 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
286
287 return RunCommand(cmd);
288 }
289
290 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
291 {
292 string command = "select * from `"+m_Realm+"` where (flags & 2) <> 0";
293 if (scopeID != UUID.Zero)
294 command += " and ScopeID = ?scopeID";
295
296 MySqlCommand cmd = new MySqlCommand(command);
297
298 cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
299
300 // TODO: distance-sort results
301 return RunCommand(cmd);
302 }
277 } 303 }
278} 304}
diff --git a/OpenSim/Data/MySQL/Resources/005_GridStore.sql b/OpenSim/Data/MySQL/Resources/005_GridStore.sql
new file mode 100644
index 0000000..835ba89
--- /dev/null
+++ b/OpenSim/Data/MySQL/Resources/005_GridStore.sql
@@ -0,0 +1,6 @@
1BEGIN;
2
3ALTER TABLE `regions` ADD COLUMN `flags` integer NOT NULL DEFAULT 0;
4CREATE INDEX flags ON regions(flags);
5
6COMMIT;
diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs
index e8263ea..92db87a 100644
--- a/OpenSim/Data/Null/NullRegionData.cs
+++ b/OpenSim/Data/Null/NullRegionData.cs
@@ -130,5 +130,15 @@ namespace OpenSim.Data.Null
130 130
131 return true; 131 return true;
132 } 132 }
133
134 public List<RegionData> GetDefaultRegions(UUID scopeID)
135 {
136 return null;
137 }
138
139 public List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y)
140 {
141 return null;
142 }
133 } 143 }
134} 144}
diff --git a/OpenSim/Data/RegionProfileData.cs b/OpenSim/Data/RegionProfileData.cs
index 86d7f6b..90713d2 100644
--- a/OpenSim/Data/RegionProfileData.cs
+++ b/OpenSim/Data/RegionProfileData.cs
@@ -136,7 +136,6 @@ namespace OpenSim.Data
136 /// </summary> 136 /// </summary>
137 public uint maturity; 137 public uint maturity;
138 138
139
140 //Data Wrappers 139 //Data Wrappers
141 public string RegionName 140 public string RegionName
142 { 141 {
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
index 93cb60c..501f730 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/HGGridConnector.cs
@@ -808,6 +808,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
808 808
809 #endregion 809 #endregion
810 810
811 public List<GridRegion> GetDefaultRegions(UUID scopeID)
812 {
813 return null;
814 }
815
816 public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
817 {
818 return null;
819 }
820
821 public int GetRegionFlags(UUID scopeID, UUID regionID)
822 {
823 return 0;
824 }
811 825
812 } 826 }
813} 827}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
index 1c72488..f0081fc 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -250,5 +250,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
250 m_log.InfoFormat(" {0} @ {1}={2}", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); 250 m_log.InfoFormat(" {0} @ {1}={2}", r.RegionName, r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize);
251 } 251 }
252 } 252 }
253
254 public List<GridRegion> GetDefaultRegions(UUID scopeID)
255 {
256 return null;
257 }
258
259 public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
260 {
261 return null;
262 }
263
264 public int GetRegionFlags(UUID scopeID, UUID regionID)
265 {
266 return 0;
267 }
268
253 } 269 }
254} 270}
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
index 99aa3fb..7f1f2fd 100644
--- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs
@@ -450,5 +450,19 @@ namespace OpenSim.Services.Connectors
450 450
451 #endregion 451 #endregion
452 452
453 public List<GridRegion> GetDefaultRegions(UUID scopeID)
454 {
455 return null;
456 }
457
458 public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
459 {
460 return null;
461 }
462
463 public int GetRegionFlags(UUID scopeID, UUID regionID)
464 {
465 return 0;
466 }
453 } 467 }
454} 468}
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 86815e5..884bc95 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -46,10 +46,18 @@ namespace OpenSim.Services.GridService
46 LogManager.GetLogger( 46 LogManager.GetLogger(
47 MethodBase.GetCurrentMethod().DeclaringType); 47 MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 private bool m_DeleteOnUnregister = true;
50
49 public GridService(IConfigSource config) 51 public GridService(IConfigSource config)
50 : base(config) 52 : base(config)
51 { 53 {
52 m_log.DebugFormat("[GRID SERVICE]: Starting..."); 54 m_log.DebugFormat("[GRID SERVICE]: Starting...");
55
56 IConfig gridConfig = config.Configs["GridService"];
57 if (gridConfig != null)
58 {
59 m_DeleteOnUnregister = gridConfig.GetBoolean("DeleteOnUnregister", true);
60 }
53 } 61 }
54 62
55 #region IGridService 63 #region IGridService
@@ -85,6 +93,15 @@ namespace OpenSim.Services.GridService
85 // Everything is ok, let's register 93 // Everything is ok, let's register
86 RegionData rdata = RegionInfo2RegionData(regionInfos); 94 RegionData rdata = RegionInfo2RegionData(regionInfos);
87 rdata.ScopeID = scopeID; 95 rdata.ScopeID = scopeID;
96
97 if (region != null)
98 {
99 rdata.Data["flags"] = region.Data["flags"]; // Preserve fields
100 }
101 int flags = Convert.ToInt32(rdata.Data["flags"]);
102 flags |= (int)OpenSim.Data.RegionFlags.RegionOnline;
103 rdata.Data["flags"] = flags.ToString();
104
88 try 105 try
89 { 106 {
90 m_Database.Store(rdata); 107 m_Database.Store(rdata);
@@ -103,6 +120,28 @@ namespace OpenSim.Services.GridService
103 public bool DeregisterRegion(UUID regionID) 120 public bool DeregisterRegion(UUID regionID)
104 { 121 {
105 m_log.DebugFormat("[GRID SERVICE]: Region {0} deregistered", regionID); 122 m_log.DebugFormat("[GRID SERVICE]: Region {0} deregistered", regionID);
123 if (!m_DeleteOnUnregister)
124 {
125 RegionData region = m_Database.Get(regionID, UUID.Zero);
126 if (region == null)
127 return false;
128
129 int flags = Convert.ToInt32(region.Data["flags"]);
130 flags &= ~(int)OpenSim.Data.RegionFlags.RegionOnline;
131 region.Data["flags"] = flags.ToString();
132 try
133 {
134 m_Database.Store(region);
135 }
136 catch (Exception e)
137 {
138 m_log.DebugFormat("[GRID SERVICE]: Database exception: {0}", e);
139 }
140
141 return true;
142
143 }
144
106 return m_Database.Delete(regionID); 145 return m_Database.Delete(regionID);
107 } 146 }
108 147
@@ -218,5 +257,35 @@ namespace OpenSim.Services.GridService
218 257
219 #endregion 258 #endregion
220 259
260 public List<GridRegion> GetDefaultRegions(UUID scopeID)
261 {
262 List<GridRegion> ret = new List<GridRegion>();
263
264 List<RegionData> regions = m_Database.GetDefaultRegions(scopeID);
265
266 foreach (RegionData r in regions)
267 ret.Add(RegionData2RegionInfo(r));
268
269 return ret;
270 }
271
272 public List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y)
273 {
274 List<GridRegion> ret = new List<GridRegion>();
275
276 List<RegionData> regions = m_Database.GetFallbackRegions(scopeID, x, y);
277
278 foreach (RegionData r in regions)
279 ret.Add(RegionData2RegionInfo(r));
280
281 return ret;
282 }
283
284 public int GetRegionFlags(UUID scopeID, UUID regionID)
285 {
286 RegionData region = m_Database.Get(regionID, scopeID);
287
288 return Convert.ToInt32(region.Data["flags"]);
289 }
221 } 290 }
222} 291}
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs
index e69e4cd..5ea136f 100644
--- a/OpenSim/Services/Interfaces/IGridService.cs
+++ b/OpenSim/Services/Interfaces/IGridService.cs
@@ -90,6 +90,10 @@ namespace OpenSim.Services.Interfaces
90 90
91 List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax); 91 List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax);
92 92
93 List<GridRegion> GetDefaultRegions(UUID scopeID);
94 List<GridRegion> GetFallbackRegions(UUID scopeID, int x, int y);
95
96 int GetRegionFlags(UUID scopeID, UUID regionID);
93 } 97 }
94 98
95 public class GridRegion 99 public class GridRegion