diff options
author | Diva Canto | 2011-01-07 11:38:54 -0800 |
---|---|---|
committer | Diva Canto | 2011-01-07 11:38:54 -0800 |
commit | 8c0e156b4d534cbc9ad21805529804610b7c78eb (patch) | |
tree | 0e829ac7adf70cf1c9e88d29918e25612cc6015c /OpenSim | |
parent | A bit more frugal on the caller side of closing agents, now that the receivin... (diff) | |
download | opensim-SC_OLD-8c0e156b4d534cbc9ad21805529804610b7c78eb.zip opensim-SC_OLD-8c0e156b4d534cbc9ad21805529804610b7c78eb.tar.gz opensim-SC_OLD-8c0e156b4d534cbc9ad21805529804610b7c78eb.tar.bz2 opensim-SC_OLD-8c0e156b4d534cbc9ad21805529804610b7c78eb.tar.xz |
Make HG map search consistent with new syntax for link-region, i.e. http://foo.org. Old syntax (foo.org) is still supported, but has surprising results when ppl search again, because internally the HG link names start with http.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Services/GridService/HypergridLinker.cs | 80 |
2 files changed, 43 insertions, 39 deletions
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index cc28a5b..a9e46d0 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs | |||
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
102 | GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName); | 102 | GridRegion info = m_scene.GridService.GetRegionByName(m_scene.RegionInfo.ScopeID, mapName); |
103 | if (info != null) regionInfos.Add(info); | 103 | if (info != null) regionInfos.Add(info); |
104 | } | 104 | } |
105 | m_log.DebugFormat("[MAPSEARCHMODULE]: search returned {0} regions", regionInfos.Count); | 105 | m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions", mapName, regionInfos.Count); |
106 | List<MapBlockData> blocks = new List<MapBlockData>(); | 106 | List<MapBlockData> blocks = new List<MapBlockData>(); |
107 | 107 | ||
108 | MapBlockData data; | 108 | MapBlockData data; |
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 16fcc65..588c1dd 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -162,6 +162,7 @@ namespace OpenSim.Services.GridService | |||
162 | 162 | ||
163 | #region Link Region | 163 | #region Link Region |
164 | 164 | ||
165 | // from map search | ||
165 | public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) | 166 | public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) |
166 | { | 167 | { |
167 | string reason = string.Empty; | 168 | string reason = string.Empty; |
@@ -171,7 +172,7 @@ namespace OpenSim.Services.GridService | |||
171 | 172 | ||
172 | private static Random random = new Random(); | 173 | private static Random random = new Random(); |
173 | 174 | ||
174 | // From the command line link-region | 175 | // From the command line link-region (obsolete) and the map |
175 | public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) | 176 | public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, out string reason) |
176 | { | 177 | { |
177 | return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); | 178 | return TryLinkRegionToCoords(scopeID, mapName, xloc, yloc, UUID.Zero, out reason); |
@@ -180,45 +181,48 @@ namespace OpenSim.Services.GridService | |||
180 | public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) | 181 | public GridRegion TryLinkRegionToCoords(UUID scopeID, string mapName, int xloc, int yloc, UUID ownerID, out string reason) |
181 | { | 182 | { |
182 | reason = string.Empty; | 183 | reason = string.Empty; |
183 | string host = "127.0.0.1"; | 184 | GridRegion regInfo = null; |
184 | string portstr; | 185 | |
185 | string regionName = ""; | 186 | if (!mapName.StartsWith("http")) |
186 | uint port = 0; | ||
187 | string[] parts = mapName.Split(new char[] { ':' }); | ||
188 | if (parts.Length >= 1) | ||
189 | { | ||
190 | host = parts[0]; | ||
191 | } | ||
192 | if (parts.Length >= 2) | ||
193 | { | ||
194 | portstr = parts[1]; | ||
195 | //m_log.Debug("-- port = " + portstr); | ||
196 | if (!UInt32.TryParse(portstr, out port)) | ||
197 | regionName = parts[1]; | ||
198 | } | ||
199 | // always take the last one | ||
200 | if (parts.Length >= 3) | ||
201 | { | 187 | { |
202 | regionName = parts[2]; | 188 | string host = "127.0.0.1"; |
203 | } | 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 | } | ||
204 | 209 | ||
205 | //// Sanity check. | ||
206 | //try | ||
207 | //{ | ||
208 | // Util.GetHostFromDNS(host); | ||
209 | //} | ||
210 | //catch | ||
211 | //{ | ||
212 | // reason = "Malformed hostname"; | ||
213 | // return null; | ||
214 | //} | ||
215 | 210 | ||
216 | GridRegion regInfo; | 211 | bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason); |
217 | bool success = TryCreateLink(scopeID, xloc, yloc, regionName, port, host, ownerID, out regInfo, out reason); | 212 | if (success) |
218 | if (success) | 213 | { |
214 | regInfo.RegionName = mapName; | ||
215 | return regInfo; | ||
216 | } | ||
217 | } | ||
218 | else | ||
219 | { | 219 | { |
220 | regInfo.RegionName = mapName; | 220 | string[] parts = mapName.Split(new char[] {' '}); |
221 | return regInfo; | 221 | string regionName = String.Empty; |
222 | if (parts.Length > 1) | ||
223 | regionName = parts[1]; | ||
224 | if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason)) | ||
225 | return regInfo; | ||
222 | } | 226 | } |
223 | 227 | ||
224 | return null; | 228 | return null; |
@@ -231,7 +235,7 @@ namespace OpenSim.Services.GridService | |||
231 | 235 | ||
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) | 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) |
233 | { | 237 | { |
234 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", | 238 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", |
235 | ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), | 239 | ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), |
236 | remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); | 240 | remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); |
237 | 241 | ||
@@ -324,7 +328,7 @@ namespace OpenSim.Services.GridService | |||
324 | regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); | 328 | regInfo.TerrainImage = m_GatekeeperConnector.GetMapImage(regionID, imageURL, m_MapTileDirectory); |
325 | 329 | ||
326 | AddHyperlinkRegion(regInfo, handle); | 330 | AddHyperlinkRegion(regInfo, handle); |
327 | m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region_uuid {0} with image {1}", regInfo.RegionID, regInfo.TerrainImage); | 331 | m_log.InfoFormat("[HYPERGRID LINKER]: Successfully linked to region {0} with image {1}", regInfo.RegionName, regInfo.TerrainImage); |
328 | return true; | 332 | return true; |
329 | } | 333 | } |
330 | 334 | ||