aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService
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 83ec122..186ca71 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -174,7 +174,6 @@ namespace OpenSim.Services.GridService
174 174
175 #region Link Region 175 #region Link Region
176 176
177 // from map search
178 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) 177 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor)
179 { 178 {
180 string reason = string.Empty; 179 string reason = string.Empty;
@@ -184,7 +183,7 @@ namespace OpenSim.Services.GridService
184 183
185 private static Random random = new Random(); 184 private static Random random = new Random();
186 185
187 // From the command line link-region (obsolete) and the map 186 // From the command line link-region
188 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) 187 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason)
189 { 188 {
190 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); 189 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
@@ -193,54 +192,19 @@ namespace OpenSim.Services.GridService
193 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) 192 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
194 { 193 {
195 reason = string.Empty; 194 reason = string.Empty;
196 GridRegion regInfo = null; 195 uint port = 0;
197 196 string[] parts = mapName.Split(new char[] {':'});
198 if (!mapName.StartsWith("http")) 197 string regionName = String.Empty;
198 if (parts.Length > 1)
199 { 199 {
200 string host = "127.0.0.1"; 200 regionName = mapName.Substring(parts[0].Length + 1);
201 string portstr; 201 regionName = regionName.Trim(new char[] {'"'});
202 string regionName = "";
203 uint port = 0;
204 string[] parts = mapName.Split(new char[] { ':' });
205 if (parts.Length >= 1)
206 {
207 host = parts[0];
208 }
209 if (parts.Length >= 2)
210 {
211 portstr = parts[1];
212 //m_log.Debug("-- port = " + portstr);
213 if (!UInt32.TryParse(portstr, out port))
214 regionName = parts[1];
215 }
216 // always take the last one
217 if (parts.Length >= 3)
218 {
219 regionName = parts[2];
220 }
221
222
223 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
224 if (success)
225 {
226 regInfo.RegionName = mapName;
227 return regInfo;
228 }
229 } 202 }
230 else 203 GridRegion regInfo;
204 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
231 { 205 {
232 string[] parts = mapName.Split(new char[] {' '}); 206 regInfo.RegionName = mapName;
233 string regionName = String.Empty; 207 return regInfo;
234 if (parts.Length > 1)
235 {
236 regionName = mapName.Substring(parts[0].Length + 1);
237 regionName = regionName.Trim(new char[] {'"'});
238 }
239 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
240 {
241 regInfo.RegionName = mapName;
242 return regInfo;
243 }
244 } 208 }
245 209
246 return null; 210 return null;
@@ -253,7 +217,7 @@ namespace OpenSim.Services.GridService
253 217
254 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) 218 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)
255 { 219 {
256 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", 220 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}",
257 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), 221 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
258 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); 222 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
259 223
@@ -376,7 +340,7 @@ namespace OpenSim.Services.GridService
376 regInfo.RegionSecret = handle.ToString(); 340 regInfo.RegionSecret = handle.ToString();
377 341
378 AddHyperlinkRegion(regInfo, handle); 342 AddHyperlinkRegion(regInfo, handle);
379 m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); 343 m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID);
380 return true; 344 return true;
381 } 345 }
382 346