aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJonathan Freedman2010-10-29 23:46:53 -0400
committerJonathan Freedman2010-10-29 23:46:53 -0400
commit594f23ff225b4c4d438a89eefd6337cf281e093c (patch)
treef617129f759c91ff27b07f2e8f23712a9800c45e /OpenSim
parentMerge branch 'master' into mantis5110 (diff)
parentHypergridLinker optimizations and enable use of owner_uuid/EstateOwner with l... (diff)
downloadopensim-SC_OLD-594f23ff225b4c4d438a89eefd6337cf281e093c.zip
opensim-SC_OLD-594f23ff225b4c4d438a89eefd6337cf281e093c.tar.gz
opensim-SC_OLD-594f23ff225b4c4d438a89eefd6337cf281e093c.tar.bz2
opensim-SC_OLD-594f23ff225b4c4d438a89eefd6337cf281e093c.tar.xz
Merge branch 'master' into mantis5110
Conflicts: OpenSim/Services/GridService/HypergridLinker.cs
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs52
1 files changed, 29 insertions, 23 deletions
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index c273d21..50da1bd 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Linq;
30using System.Net; 31using System.Net;
31using System.Reflection; 32using System.Reflection;
32using System.Xml; 33using System.Xml;
@@ -155,6 +156,11 @@ namespace OpenSim.Services.GridService
155 // From the command line link-region 156 // From the command line link-region
156 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) 157 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason)
157 { 158 {
159 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
160 }
161
162 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
163 {
158 reason = string.Empty; 164 reason = string.Empty;
159 string host = "127.0.0.1"; 165 string host = "127.0.0.1";
160 string portstr; 166 string portstr;
@@ -190,7 +196,7 @@ namespace OpenSim.Services.GridService
190 //} 196 //}
191 197
192 GridRegion regInfo; 198 GridRegion regInfo;
193 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, out regInfo, out reason); 199 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
194 if (success) 200 if (success)
195 { 201 {
196 regInfo.RegionName = mapName; 202 regInfo.RegionName = mapName;
@@ -200,12 +206,12 @@ namespace OpenSim.Services.GridService
200 return null; 206 return null;
201 } 207 }
202 208
203 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) 209 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, UUID ownerID, out GridRegion regInfo, out string reason)
204 { 210 {
205 return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, out regInfo, out reason); 211 return TryCreateLink(scopeID, xloc, yloc, externalRegionName, externalPort, externalHostName, null, ownerID, out regInfo, out reason);
206 } 212 }
207 213
208 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, string serverURI, out GridRegion regInfo, out string reason) 214 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string externalRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason)
209 { 215 {
210 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); 216 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc);
211 217
@@ -225,6 +231,16 @@ namespace OpenSim.Services.GridService
225 regInfo.RegionLocX = xloc; 231 regInfo.RegionLocX = xloc;
226 regInfo.RegionLocY = yloc; 232 regInfo.RegionLocY = yloc;
227 regInfo.ScopeID = scopeID; 233 regInfo.ScopeID = scopeID;
234 regInfo.EstateOwner = ownerID;
235
236 // Check for free coordinates
237 GridRegion region = m_GridService.GetRegionByPosition(regInfo.ScopeID, regInfo.RegionLocX, regInfo.RegionLocY);
238 if (region != null)
239 {
240 m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", regInfo.RegionLocX, regInfo.RegionLocY, region.RegionName, region.RegionID);
241 reason = "Coordinates are already in use";
242 return false;
243 }
228 244
229 try 245 try
230 { 246 {
@@ -247,11 +263,11 @@ namespace OpenSim.Services.GridService
247 263
248 if (regionID != UUID.Zero) 264 if (regionID != UUID.Zero)
249 { 265 {
250 GridRegion r = m_GridService.GetRegionByUUID(scopeID, regionID); 266 region = m_GridService.GetRegionByUUID(scopeID, regionID);
251 if (r != null) 267 if (region != null)
252 { 268 {
253 m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", r.RegionLocX / Constants.RegionSize, r.RegionLocY / Constants.RegionSize); 269 m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize);
254 regInfo = r; 270 regInfo = region;
255 return true; 271 return true;
256 } 272 }
257 273
@@ -366,17 +382,8 @@ namespace OpenSim.Services.GridService
366 { 382 {
367 // Check for regions which are not linked regions 383 // Check for regions which are not linked regions
368 List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID); 384 List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
369 // would like to use .Except, but doesn't seem to exist 385 IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
370 //IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks); 386 if (availableRegions.Count() == 0)
371 List<GridRegion> availableRegions = regions.FindAll(delegate(GridRegion region)
372 {
373 // Ewww! n^2
374 if (hyperlinks.Find(delegate(GridRegion r) { return r.RegionID == region.RegionID; }) == null) // not hyperlink. good.
375 return true;
376
377 return false;
378 });
379 if (availableRegions.Count == 0)
380 return false; 387 return false;
381 } 388 }
382 389
@@ -458,7 +465,7 @@ namespace OpenSim.Services.GridService
458 remoteName = cmdparams[3]; 465 remoteName = cmdparams[3];
459 string reason = string.Empty; 466 string reason = string.Empty;
460 GridRegion regInfo; 467 GridRegion regInfo;
461 TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, out regInfo, out reason); 468 TryCreateLink(UUID.Zero, xloc, yloc, remoteName, 0, null, serverURI, UUID.Zero, out regInfo, out reason);
462 } 469 }
463 470
464 private void RunHGCommand(string command, string[] cmdparams) 471 private void RunHGCommand(string command, string[] cmdparams)
@@ -571,7 +578,7 @@ namespace OpenSim.Services.GridService
571 xloc = xloc * (int)Constants.RegionSize; 578 xloc = xloc * (int)Constants.RegionSize;
572 yloc = yloc * (int)Constants.RegionSize; 579 yloc = yloc * (int)Constants.RegionSize;
573 string reason = string.Empty; 580 string reason = string.Empty;
574 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, out regInfo, out reason)) 581 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
575 { 582 {
576 if (cmdparams.Length >= 5) 583 if (cmdparams.Length >= 5)
577 { 584 {
@@ -673,8 +680,7 @@ namespace OpenSim.Services.GridService
673 xloc = xloc * (int)Constants.RegionSize; 680 xloc = xloc * (int)Constants.RegionSize;
674 yloc = yloc * (int)Constants.RegionSize; 681 yloc = yloc * (int)Constants.RegionSize;
675 string reason = string.Empty; 682 string reason = string.Empty;
676 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, 683 if (TryCreateLink(UUID.Zero, xloc, yloc, "", externalPort, externalHostName, UUID.Zero, out regInfo, out reason))
677 externalHostName, out regInfo, out reason))
678 { 684 {
679 regInfo.RegionName = config.GetString("localName", ""); 685 regInfo.RegionName = config.GetString("localName", "");
680 } 686 }