diff options
Diffstat (limited to 'OpenSim/Services/GridService')
-rw-r--r-- | OpenSim/Services/GridService/HypergridLinker.cs | 77 |
1 files changed, 41 insertions, 36 deletions
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 9d98c8f..553c116 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,42 +180,47 @@ 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; | 191 | } |
190 | string regionName = ""; | 192 | if (parts.Length >= 2) |
191 | uint port = 0; | 193 | { |
192 | string[] parts = mapName.Split(new char[] { ':' }); | 194 | <<<<<<< HEAD:OpenSim/Services/GridService/HypergridLinker.cs |
193 | if (parts.Length >= 1) | 195 | portstr = parts[1]; |
194 | { | 196 | //m_log.Debug("-- port = " + portstr); |
195 | host = parts[0]; | 197 | if (!UInt32.TryParse(portstr, out port)) |
196 | } | 198 | regionName = parts[1]; |
197 | if (parts.Length >= 2) | 199 | } |
198 | { | 200 | // always take the last one |
199 | portstr = parts[1]; | 201 | if (parts.Length >= 3) |
200 | //m_log.Debug("-- port = " + portstr); | 202 | { |
201 | if (!UInt32.TryParse(portstr, out port)) | 203 | regionName = parts[2]; |
202 | regionName = parts[1]; | 204 | } |
203 | } | ||
204 | // always take the last one | ||
205 | if (parts.Length >= 3) | ||
206 | { | ||
207 | regionName = parts[2]; | ||
208 | } | ||
209 | 205 | ||
206 | //// Sanity check. | ||
207 | //try | ||
208 | //{ | ||
209 | // Util.GetHostFromDNS(host); | ||
210 | //} | ||
211 | //catch | ||
212 | //{ | ||
213 | // reason = "Malformed hostname"; | ||
214 | // return null; | ||
215 | //} | ||
210 | 216 | ||
211 | bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason); | 217 | GridRegion regInfo; |
212 | if (success) | 218 | bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason); |
213 | { | 219 | if (success) |
214 | regInfo.RegionName = mapName; | ||
215 | return regInfo; | ||
216 | } | ||
217 | } | ||
218 | else | ||
219 | { | 220 | { |
221 | regInfo.RegionName = mapName; | ||
222 | return regInfo; | ||
223 | ======= | ||
220 | string[] parts = mapName.Split(new char[] {' '}); | 224 | string[] parts = mapName.Split(new char[] {' '}); |
221 | string regionName = String.Empty; | 225 | string regionName = String.Empty; |
222 | if (parts.Length > 1) | 226 | if (parts.Length > 1) |
@@ -229,6 +233,7 @@ namespace OpenSim.Services.GridService | |||
229 | regInfo.RegionName = mapName; | 233 | regInfo.RegionName = mapName; |
230 | return regInfo; | 234 | return regInfo; |
231 | } | 235 | } |
236 | >>>>>>> master:OpenSim/Services/GridService/HypergridLinker.cs | ||
232 | } | 237 | } |
233 | 238 | ||
234 | return null; | 239 | return null; |
@@ -241,7 +246,7 @@ namespace OpenSim.Services.GridService | |||
241 | 246 | ||
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) | 247 | 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 | { | 248 | { |
244 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", | 249 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", |
245 | ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), | 250 | ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), |
246 | remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); | 251 | remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); |
247 | 252 | ||
@@ -334,7 +339,7 @@ namespace OpenSim.Services.GridService | |||
334 | regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); | 339 | regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); |
335 | 340 | ||
336 | AddHyperlinkRegion(regInfo, handle); | 341 | AddHyperlinkRegion(regInfo, handle); |
337 | m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); | 342 | m_log.Info("[HYPERGRID LINKER]: Successfully linked to region_uuid " + regInfo.RegionID); |
338 | return true; | 343 | return true; |
339 | } | 344 | } |
340 | 345 | ||