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.cs80
1 files changed, 38 insertions, 42 deletions
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs
index 588c1dd..c02c813 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,48 +180,45 @@ 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 string host = "127.0.0.1";
185 184 string portstr;
186 if (!mapName.StartsWith("http")) 185 string regionName = "";
186 uint port = 0;
187 string[] parts = mapName.Split(new char[] { ':' });
188 if (parts.Length >= 1)
187 { 189 {
188 string host = "127.0.0.1"; 190 host = parts[0];
189 string portstr;
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 } 191 }
218 else 192 if (parts.Length >= 2)
219 { 193 {
220 string[] parts = mapName.Split(new char[] {' '}); 194 portstr = parts[1];
221 string regionName = String.Empty; 195 //m_log.Debug("-- port = " + portstr);
222 if (parts.Length > 1) 196 if (!UInt32.TryParse(portstr, out port))
223 regionName = parts[1]; 197 regionName = parts[1];
224 if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason)) 198 }
225 return regInfo; 199 // always take the last one
200 if (parts.Length >= 3)
201 {
202 regionName = parts[2];
203 }
204
205 //// Sanity check.
206 //try
207 //{
208 // Util.GetHostFromDNS(host);
209 //}
210 //catch
211 //{
212 // reason = "Malformed hostname";
213 // return null;
214 //}
215
216 GridRegion regInfo;
217 bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason);
218 if (success)
219 {
220 regInfo.RegionName = mapName;
221 return regInfo;
226 } 222 }
227 223
228 return null; 224 return null;
@@ -235,7 +231,7 @@ namespace OpenSim.Services.GridService
235 231
236 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) 232 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)
237 { 233 {
238 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", 234 m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}",
239 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), 235 ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI),
240 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); 236 remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize);
241 237
@@ -328,7 +324,7 @@ namespace OpenSim.Services.GridService
328 regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); 324 regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory);
329 325
330 AddHyperlinkRegion(regInfo, handle); 326 AddHyperlinkRegion(regInfo, handle);
331 m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); 327 m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID);
332 return true; 328 return true;
333 } 329 }
334 330