aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService/HypergridLinker.cs
diff options
context:
space:
mode:
authorMelanie2012-03-27 01:46:02 +0100
committerMelanie2012-03-27 01:46:02 +0100
commit0964af41be176bda881ad2f1ca6e45c97f82b093 (patch)
tree8e6580b58f5c05df6ef225cb91a9c84912725dbc /OpenSim/Services/GridService/HypergridLinker.cs
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC-0964af41be176bda881ad2f1ca6e45c97f82b093.zip
opensim-SC-0964af41be176bda881ad2f1ca6e45c97f82b093.tar.gz
opensim-SC-0964af41be176bda881ad2f1ca6e45c97f82b093.tar.bz2
opensim-SC-0964af41be176bda881ad2f1ca6e45c97f82b093.tar.xz
Replace HG linker with core version
Diffstat (limited to 'OpenSim/Services/GridService/HypergridLinker.cs')
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs62
1 files changed, 49 insertions, 13 deletions
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 46d68c2..78eab3d 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -176,6 +176,7 @@ namespace OpenSim.Services.GridService
176 176
177 #region Link Region 177 #region Link Region
178 178
179 // from map search
179 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) 180 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor)
180 { 181 {
181 string reason = string.Empty; 182 string reason = string.Empty;
@@ -185,7 +186,7 @@ namespace OpenSim.Services.GridService
185 186
186 private static Random random = new Random(); 187 private static Random random = new Random();
187 188
188 // From the command line link-region 189 // From the command line link-region (obsolete) and the map
189 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) 190 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason)
190 { 191 {
191 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); 192 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
@@ -194,19 +195,54 @@ namespace OpenSim.Services.GridService
194 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) 195 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
195 { 196 {
196 reason = string.Empty; 197 reason = string.Empty;
197 uint port = 0; 198 GridRegion regInfo = null;
198 string[] parts = mapName.Split(new char[] {':'}); 199
199 string regionName = String.Empty; 200 if (!mapName.StartsWith("http"))
200 if (parts.Length > 1)
201 { 201 {
202 regionName = mapName.Substring(parts[0].Length + 1); 202 string host = "127.0.0.1";
203 regionName = regionName.Trim(new char[] {'"'}); 203 string portstr;
204 string regionName = "";
205 uint port = 0;
206 string[] parts = mapName.Split(new char[] { ':' });
207 if (parts.Length >= 1)
208 {
209 host = parts[0];
210 }
211 if (parts.Length >= 2)
212 {
213 portstr = parts[1];
214 //m_log.Debug("-- port = " + portstr);
215 if (!UInt32.TryParse(portstr, out port))
216 regionName = parts[1];
217 }
218 // always take the last one
219 if (parts.Length >= 3)
220 {
221 regionName = parts[2];
222 }
223
224
225 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
226 if (success)
227 {
228 regInfo.RegionName = mapName;
229 return regInfo;
230 }
204 } 231 }
205 GridRegion regInfo; 232 else
206 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
207 { 233 {
208 regInfo.RegionName = mapName; 234 string[] parts = mapName.Split(new char[] {' '});
209 return regInfo; 235 string regionName = String.Empty;
236 if (parts.Length > 1)
237 {
238 regionName = mapName.Substring(parts[0].Length + 1);
239 regionName = regionName.Trim(new char[] {'"'});
240 }
241 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
242 {
243 regInfo.RegionName = mapName;
244 return regInfo;
245 }
210 } 246 }
211 247
212 return null; 248 return null;
@@ -219,7 +255,7 @@ namespace OpenSim.Services.GridService
219 255
220 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason) 256 public bool TryCreateLink(UUID scopeID, int xloc, int yloc, string remoteRegionName, uint externalPort, string externalHostName, string serverURI, UUID ownerID, out GridRegion regInfo, out string reason)
221 { 257 {
222 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", 258 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}",
223 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), 259 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
224 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); 260 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
225 261
@@ -342,7 +378,7 @@ namespace OpenSim.Services.GridService
342 regInfo.RegionSecret = handle.ToString(); 378 regInfo.RegionSecret = handle.ToString();
343 379
344 AddHyperlinkRegion(regInfo, handle); 380 AddHyperlinkRegion(regInfo, handle);
345 m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID); 381 m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage);
346 return true; 382 return true;
347 } 383 }
348 384