aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService/HypergridLinker.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-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 78eab3d..46d68c2 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -176,7 +176,6 @@ namespace OpenSim.Services.GridService
176 176
177 #region Link Region 177 #region Link Region
178 178
179 // from map search
180 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) 179 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor)
181 { 180 {
182 string reason = string.Empty; 181 string reason = string.Empty;
@@ -186,7 +185,7 @@ namespace OpenSim.Services.GridService
186 185
187 private static Random random = new Random(); 186 private static Random random = new Random();
188 187
189 // From the command line link-region (obsolete) and the map 188 // From the command line link-region
190 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) 189 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason)
191 { 190 {
192 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); 191 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
@@ -195,54 +194,19 @@ namespace OpenSim.Services.GridService
195 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) 194 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
196 { 195 {
197 reason = string.Empty; 196 reason = string.Empty;
198 GridRegion regInfo = null; 197 uint port = 0;
199 198 string[] parts = mapName.Split(new char[] {':'});
200 if (!mapName.StartsWith("http")) 199 string regionName = String.Empty;
200 if (parts.Length > 1)
201 { 201 {
202 string host = "127.0.0.1"; 202 regionName = mapName.Substring(parts[0].Length + 1);
203 string portstr; 203 regionName = regionName.Trim(new char[] {'"'});
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 }
231 } 204 }
232 else 205 GridRegion regInfo;
206 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
233 { 207 {
234 string[] parts = mapName.Split(new char[] {' '}); 208 regInfo.RegionName = mapName;
235 string regionName = String.Empty; 209 return regInfo;
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 }
246 } 210 }
247 211
248 return null; 212 return null;
@@ -255,7 +219,7 @@ namespace OpenSim.Services.GridService
255 219
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) 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)
257 { 221 {
258 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", 222 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}",
259 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), 223 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
260 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); 224 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
261 225
@@ -378,7 +342,7 @@ namespace OpenSim.Services.GridService
378 regInfo.RegionSecret = handle.ToString(); 342 regInfo.RegionSecret = handle.ToString();
379 343
380 AddHyperlinkRegion(regInfo, handle); 344 AddHyperlinkRegion(regInfo, handle);
381 m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); 345 m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID);
382 return true; 346 return true;
383 } 347 }
384 348