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 12ea453..a4aa44d 100644
--- a/OpenSim/Services/GridService/HypergridLinker.cs
+++ b/OpenSim/Services/GridService/HypergridLinker.cs
@@ -162,7 +162,6 @@ namespace OpenSim.Services.GridService
162 162
163 #region Link Region 163 #region Link Region
164 164
165 // from map search
166 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) 165 public GridRegion LinkRegion(UUID scopeID, string regionDescriptor)
167 { 166 {
168 string reason = string.Empty; 167 string reason = string.Empty;
@@ -172,7 +171,7 @@ namespace OpenSim.Services.GridService
172 171
173 private static Random random = new Random(); 172 private static Random random = new Random();
174 173
175 // From the command line link-region (obsolete) and the map 174 // From the command line link-region
176 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) 175 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason)
177 { 176 {
178 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); 177 return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason);
@@ -181,54 +180,19 @@ namespace OpenSim.Services.GridService
181 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) 180 public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason)
182 { 181 {
183 reason = string.Empty; 182 reason = string.Empty;
184 GridRegion regInfo = null; 183 uint port = 0;
185 184 string[] parts = mapName.Split(new char[] {':'});
186 if (!mapName.StartsWith("http")) 185 string regionName = String.Empty;
186 if (parts.Length > 1)
187 { 187 {
188 string host = "127.0.0.1"; 188 regionName = mapName.Substring(parts[0].Length + 1);
189 string portstr; 189 regionName = regionName.Trim(new char[] {'"'});
190 string regionName = "";
191 uint port = 0;
192 string[] parts = mapName.Split(new char[] { ':' });
193 if (parts.Length >= 1)
194 {
195 host = parts[0];
196 }
197 if (parts.Length >= 2)
198 {
199 portstr = parts[1];
200 //m_log.Debug("-- port = " + portstr);
201 if (!UInt32.TryParse(portstr, out port))
202 regionName = parts[1];
203 }
204 // always take the last one
205 if (parts.Length >= 3)
206 {
207 regionName = parts[2];
208 }
209
210
211 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
212 if (success)
213 {
214 regInfo.RegionName = mapName;
215 return regInfo;
216 }
217 } 190 }
218 else 191 GridRegion regInfo;
192 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
219 { 193 {
220 string[] parts = mapName.Split(new char[] {' '}); 194 regInfo.RegionName = mapName;
221 string regionName = String.Empty; 195 return regInfo;
222 if (parts.Length > 1)
223 {
224 regionName = mapName.Substring(parts[0].Length + 1);
225 regionName = regionName.Trim(new char[] {'"'});
226 }
227 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason))
228 {
229 regInfo.RegionName = mapName;
230 return regInfo;
231 }
232 } 196 }
233 197
234 return null; 198 return null;
@@ -241,7 +205,7 @@ namespace OpenSim.Services.GridService
241 205
242 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) 206 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)
243 { 207 {
244 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", 208 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}",
245 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), 209 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
246 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); 210 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
247 211
@@ -334,7 +298,7 @@ namespace OpenSim.Services.GridService
334 regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); 298 regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory);
335 299
336 AddHyperlinkRegion(regInfo, handle); 300 AddHyperlinkRegion(regInfo, handle);
337 m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); 301 m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID);
338 return true; 302 return true;
339 } 303 }
340 304