aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService
diff options
context:
space:
mode:
authorDiva Canto2010-01-24 16:00:28 -0800
committerDiva Canto2010-01-24 16:00:28 -0800
commit8ddf787cfd090fc8f2715a6f2a5329348a12e28b (patch)
tree84e88a8f2b6e72b89182b8afa4ef5747083bb04e /OpenSim/Services/GridService
parentSome method implementations were missing from LocalGridServiceConnector. (diff)
downloadopensim-SC_OLD-8ddf787cfd090fc8f2715a6f2a5329348a12e28b.zip
opensim-SC_OLD-8ddf787cfd090fc8f2715a6f2a5329348a12e28b.tar.gz
opensim-SC_OLD-8ddf787cfd090fc8f2715a6f2a5329348a12e28b.tar.bz2
opensim-SC_OLD-8ddf787cfd090fc8f2715a6f2a5329348a12e28b.tar.xz
Hypergrid map search back on, this time with a config var in the grid service.
Diffstat (limited to 'OpenSim/Services/GridService')
-rw-r--r--OpenSim/Services/GridService/GridService.cs20
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs39
2 files changed, 37 insertions, 22 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index b86fd4d..515d620 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -54,6 +54,7 @@ namespace OpenSim.Services.GridService
54 54
55 protected IAuthenticationService m_AuthenticationService = null; 55 protected IAuthenticationService m_AuthenticationService = null;
56 protected bool m_AllowDuplicateNames = false; 56 protected bool m_AllowDuplicateNames = false;
57 protected bool m_AllowHypergridMapSearch = false;
57 58
58 public GridService(IConfigSource config) 59 public GridService(IConfigSource config)
59 : base(config) 60 : base(config)
@@ -74,6 +75,7 @@ namespace OpenSim.Services.GridService
74 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args); 75 m_AuthenticationService = ServerUtils.LoadPlugin<IAuthenticationService>(authService, args);
75 } 76 }
76 m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames); 77 m_AllowDuplicateNames = gridConfig.GetBoolean("AllowDuplicateNames", m_AllowDuplicateNames);
78 m_AllowHypergridMapSearch = gridConfig.GetBoolean("AllowHypergridMapSearch", m_AllowHypergridMapSearch);
77 } 79 }
78 80
79 if (m_RootInstance == null) 81 if (m_RootInstance == null)
@@ -327,6 +329,13 @@ namespace OpenSim.Services.GridService
327 } 329 }
328 } 330 }
329 331
332 if (m_AllowHypergridMapSearch && rdatas.Count == 0 && name.Contains("."))
333 {
334 GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name);
335 if (r != null)
336 rinfos.Add(r);
337 }
338
330 return rinfos; 339 return rinfos;
331 } 340 }
332 341
@@ -410,9 +419,14 @@ namespace OpenSim.Services.GridService
410 { 419 {
411 RegionData region = m_Database.Get(regionID, scopeID); 420 RegionData region = m_Database.Get(regionID, scopeID);
412 421
413 int flags = Convert.ToInt32(region.Data["flags"]); 422 if (region != null)
414 //m_log.DebugFormat("[GRID SERVICE]: Request for flags of {0}: {1}", regionID, flags); 423 {
415 return flags; 424 int flags = Convert.ToInt32(region.Data["flags"]);
425 //m_log.DebugFormat("[GRID SERVICE]: Request for flags of {0}: {1}", regionID, flags);
426 return flags;
427 }
428 else
429 return -1;
416 } 430 }
417 431
418 private void HandleShowRegion(string module, string[] cmd) 432 private void HandleShowRegion(string module, string[] cmd)
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index b0cf723..1289cf6 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -130,26 +130,17 @@ namespace OpenSim.Services.GridService
130 130
131 #region Link Region 131 #region Link Region
132 132
133 public bool LinkRegion(string regionDescriptor, out UUID regionID, out ulong regionHandle, out string imageURL, out string reason) 133 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor)
134 { 134 {
135 regionID = UUID.Zero; 135 string reason = string.Empty;
136 imageURL = string.Empty;
137 regionHandle = 0;
138 reason = string.Empty;
139 int xloc = random.Next(0, Int16.MaxValue) * (int)Constants.RegionSize; 136 int xloc = random.Next(0, Int16.MaxValue) * (int)Constants.RegionSize;
140 GridRegion region = TryLinkRegionToCoords(regionDescriptor, xloc, 0, out reason); 137 return TryLinkRegionToCoords(scopeID, regionDescriptor, xloc, 0, out reason);
141 if (region == null)
142 return false;
143
144 regionID = region.RegionID;
145 regionHandle = region.RegionHandle;
146 return true;
147 } 138 }
148 139
149 private static Random random = new Random(); 140 private static Random random = new Random();
150 141
151 // From the command line link-region 142 // From the command line link-region
152 public GridRegion TryLinkRegionToCoords(string mapName, int xloc, int yloc, out string reason) 143 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason)
153 { 144 {
154 reason = string.Empty; 145 reason = string.Empty;
155 string host = "127.0.0.1"; 146 string host = "127.0.0.1";
@@ -183,7 +174,7 @@ namespace OpenSim.Services.GridService
183 catch { } 174 catch { }
184 175
185 GridRegion regInfo; 176 GridRegion regInfo;
186 bool success = TryCreateLink(xloc, yloc, regionName, port, host, out regInfo, out reason); 177 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason);
187 if (success) 178 if (success)
188 { 179 {
189 regInfo.RegionName = mapName; 180 regInfo.RegionName = mapName;
@@ -195,7 +186,7 @@ namespace OpenSim.Services.GridService
195 186
196 187
197 // From the command line and the 2 above 188 // From the command line and the 2 above
198 public bool TryCreateLink(int xloc, int yloc, 189 public bool TryCreateLink(UUID scopeID, int xloc, int yloc,
199 string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) 190 string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason)
200 { 191 {
201 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc); 192 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc);
@@ -207,6 +198,7 @@ namespace OpenSim.Services.GridService
207 regInfo.ExternalHostName = externalHostName; 198 regInfo.ExternalHostName = externalHostName;
208 regInfo.RegionLocX = xloc; 199 regInfo.RegionLocX = xloc;
209 regInfo.RegionLocY = yloc; 200 regInfo.RegionLocY = yloc;
201 regInfo.ScopeID = scopeID;
210 202
211 try 203 try
212 { 204 {
@@ -228,7 +220,16 @@ namespace OpenSim.Services.GridService
228 220
229 if (regionID != UUID.Zero) 221 if (regionID != UUID.Zero)
230 { 222 {
223 GridRegion r = m_GridService.GetRegionByUUID(scopeID, regionID);
224 if (r != null)
225 {
226 m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize);
227 regInfo = r;
228 return true;
229 }
230
231 regInfo.RegionID = regionID; 231 regInfo.RegionID = regionID;
232 regInfo.RegionName = regInfo.ExternalHostName + ":" + regInfo.HttpPort + ":" + regInfo.RegionName;
232 // Try get the map image 233 // Try get the map image
233 regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL); 234 regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL);
234 // I need a texture that works for this... the one I tried doesn't seem to be working 235 // I need a texture that works for this... the one I tried doesn't seem to be working
@@ -451,9 +452,9 @@ namespace OpenSim.Services.GridService
451 xloc = xloc * (int)Constants.RegionSize; 452 xloc = xloc * (int)Constants.RegionSize;
452 yloc = yloc * (int)Constants.RegionSize; 453 yloc = yloc * (int)Constants.RegionSize;
453 string reason = string.Empty; 454 string reason = string.Empty;
454 if (TryLinkRegionToCoords(mapName, xloc, yloc, out reason) == null) 455 if (TryLinkRegionToCoords(UUID.Zero, mapName, xloc, yloc, out reason) == null)
455 MainConsole.Instance.Output("Failed to link region: " + reason); 456 MainConsole.Instance.Output("Failed to link region: " + reason);
456 MainConsole.Instance.Output("Hyperlink estalished"); 457 MainConsole.Instance.Output("Hyperlink established");
457 } 458 }
458 else 459 else
459 { 460 {
@@ -482,7 +483,7 @@ namespace OpenSim.Services.GridService
482 xloc = xloc * (int)Constants.RegionSize; 483 xloc = xloc * (int)Constants.RegionSize;
483 yloc = yloc * (int)Constants.RegionSize; 484 yloc = yloc * (int)Constants.RegionSize;
484 string reason = string.Empty; 485 string reason = string.Empty;
485 if (TryCreateLink(xloc, yloc, "", externalPort, externalHostName, out regInfo, out reason)) 486 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, out regInfo, out reason))
486 { 487 {
487 if (cmdparams.Length >= 5) 488 if (cmdparams.Length >= 5)
488 { 489 {
@@ -584,7 +585,7 @@ namespace OpenSim.Services.GridService
584 xloc = xloc * (int)Constants.RegionSize; 585 xloc = xloc * (int)Constants.RegionSize;
585 yloc = yloc * (int)Constants.RegionSize; 586 yloc = yloc * (int)Constants.RegionSize;
586 string reason = string.Empty; 587 string reason = string.Empty;
587 if (TryCreateLink(xloc, yloc, "", externalPort, 588 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort,
588 externalHostName, out regInfo, out reason)) 589 externalHostName, out regInfo, out reason))
589 { 590 {
590 regInfo.RegionName = config.GetString("localName", ""); 591 regInfo.RegionName = config.GetString("localName", "");