aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService/HypergridLinker.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/GridService/HypergridLinker.cs')
-rw-r--r--OpenSim/Services/GridService/HypergridLinker.cs62
1 files changed, 13 insertions, 49 deletions
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 90c022f..b70b425 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -181,7 +181,6 @@ namespace OpenSim.Services.GridService
181 181
182 #region Link Region 182 #region Link Region
183 183
184 // from map search
185 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) 184 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor)
186 { 185 {
187 string reason = string.Empty; 186 string reason = string.Empty;
@@ -191,7 +190,7 @@ namespace OpenSim.Services.GridService
191 190
192 private static Random random = new Random(); 191 private static Random random = new Random();
193 192
194 // From the command line link-region (obsolete) and the map 193 // From the command line link-region
195 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) 194 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason)
196 { 195 {
197 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); 196 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
@@ -200,54 +199,19 @@ namespace OpenSim.Services.GridService
200 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) 199 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
201 { 200 {
202 reason = string.Empty; 201 reason = string.Empty;
203 GridRegion regInfo = null; 202 uint port = 0;
204 203 string[] parts = mapName.Split(new char[] {':'});
205 if (!mapName.StartsWith("http")) 204 string regionName = String.Empty;
205 if (parts.Length > 1)
206 { 206 {
207 string host = "127.0.0.1"; 207 regionName = mapName.Substring(parts[0].Length + 1);
208 string portstr; 208 regionName = regionName.Trim(new char[] {'"'});
209 string regionName = "";
210 uint port = 0;
211 string[] parts = mapName.Split(new char[] { ':' });
212 if (parts.Length >= 1)
213 {
214 host = parts[0];
215 }
216 if (parts.Length >= 2)
217 {
218 portstr = parts[1];
219 //m_log.Debug("-- port = " + portstr);
220 if (!UInt32.TryParse(portstr, out port))
221 regionName = parts[1];
222 }
223 // always take the last one
224 if (parts.Length >= 3)
225 {
226 regionName = parts[2];
227 }
228
229
230 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
231 if (success)
232 {
233 regInfo.RegionName = mapName;
234 return regInfo;
235 }
236 } 209 }
237 else 210 GridRegion regInfo;
211 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
238 { 212 {
239 string[] parts = mapName.Split(new char[] {' '}); 213 regInfo.RegionName = mapName;
240 string regionName = String.Empty; 214 return regInfo;
241 if (parts.Length > 1)
242 {
243 regionName = mapName.Substring(parts[0].Length + 1);
244 regionName = regionName.Trim(new char[] {'"'});
245 }
246 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
247 {
248 regInfo.RegionName = mapName;
249 return regInfo;
250 }
251 } 215 }
252 216
253 return null; 217 return null;
@@ -260,7 +224,7 @@ namespace OpenSim.Services.GridService
260 224
261 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) 225 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)
262 { 226 {
263 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", 227 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}",
264 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), 228 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
265 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); 229 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
266 230
@@ -383,7 +347,7 @@ namespace OpenSim.Services.GridService
383 regInfo.RegionSecret = handle.ToString(); 347 regInfo.RegionSecret = handle.ToString();
384 348
385 AddHyperlinkRegion(regInfo, handle); 349 AddHyperlinkRegion(regInfo, handle);
386 m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); 350 m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID);
387 return true; 351 return true;
388 } 352 }
389 353