diff options
author | Diva Canto | 2010-05-03 09:50:55 -0700 |
---|---|---|
committer | Diva Canto | 2010-05-03 09:50:55 -0700 |
commit | b10811a13b8fab81ce00d544d8efe081792bdaaa (patch) | |
tree | d91da884fa1f43a11067f7adda2f398d3b9bf77a /OpenSim | |
parent | Fix a bug in owner change notification (diff) | |
download | opensim-SC_OLD-b10811a13b8fab81ce00d544d8efe081792bdaaa.zip opensim-SC_OLD-b10811a13b8fab81ce00d544d8efe081792bdaaa.tar.gz opensim-SC_OLD-b10811a13b8fab81ce00d544d8efe081792bdaaa.tar.bz2 opensim-SC_OLD-b10811a13b8fab81ce00d544d8efe081792bdaaa.tar.xz |
Assorted bug fixes in hypergrid linking.
Diffstat (limited to 'OpenSim')
8 files changed, 45 insertions, 31 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs index c6848bb..235914a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs | |||
@@ -113,10 +113,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid | |||
113 | 113 | ||
114 | ISimulationService simService = scene.RequestModuleInterface<ISimulationService>(); | 114 | ISimulationService simService = scene.RequestModuleInterface<ISimulationService>(); |
115 | m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); | 115 | m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); |
116 | scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper); | ||
117 | 116 | ||
118 | new UserAgentServerConnector(m_Config, MainServer.Instance); | 117 | new UserAgentServerConnector(m_Config, MainServer.Instance); |
119 | } | 118 | } |
119 | scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper); | ||
120 | } | 120 | } |
121 | 121 | ||
122 | #endregion | 122 | #endregion |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index 2c234d2..d44ddf4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs | |||
@@ -191,10 +191,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
191 | public override List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) | 191 | public override List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) |
192 | { | 192 | { |
193 | List<GridRegion> rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber); | 193 | List<GridRegion> rinfo = m_LocalGridService.GetRegionsByName(scopeID, name, maxNumber); |
194 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Local GetRegionsByName {0} found {1} regions", name, rinfo.Count); | ||
194 | List<GridRegion> grinfo = base.GetRegionsByName(scopeID, name, maxNumber); | 195 | List<GridRegion> grinfo = base.GetRegionsByName(scopeID, name, maxNumber); |
195 | 196 | ||
196 | if (grinfo != null) | 197 | if (grinfo != null) |
198 | { | ||
199 | //m_log.DebugFormat("[REMOTE GRID CONNECTOR]: Remote GetRegionsByName {0} found {1} regions", name, grinfo.Count); | ||
197 | rinfo.AddRange(grinfo); | 200 | rinfo.AddRange(grinfo); |
201 | } | ||
202 | |||
198 | return rinfo; | 203 | return rinfo; |
199 | } | 204 | } |
200 | 205 | ||
diff --git a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs index f2d9321..dcb2725 100644 --- a/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs +++ b/OpenSim/Server/Handlers/Hypergrid/GatekeeperServerConnector.cs | |||
@@ -70,7 +70,6 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
70 | server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); | 70 | server.AddXmlRPCHandler("get_region", hghandlers.GetRegion, false); |
71 | 71 | ||
72 | server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService).Handler); | 72 | server.AddHTTPHandler("/foreignagent/", new GatekeeperAgentHandler(m_GatekeeperService).Handler); |
73 | |||
74 | } | 73 | } |
75 | 74 | ||
76 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) | 75 | public GatekeeperServiceInConnector(IConfigSource config, IHttpServer server) |
diff --git a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs index 0b65245..5d03097 100644 --- a/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs +++ b/OpenSim/Server/Handlers/Hypergrid/HypergridHandlers.cs | |||
@@ -48,6 +48,7 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
48 | public HypergridHandlers(IGatekeeperService gatekeeper) | 48 | public HypergridHandlers(IGatekeeperService gatekeeper) |
49 | { | 49 | { |
50 | m_GatekeeperService = gatekeeper; | 50 | m_GatekeeperService = gatekeeper; |
51 | m_log.DebugFormat("[HYPERGRID HANDLERS]: Active"); | ||
51 | } | 52 | } |
52 | 53 | ||
53 | /// <summary> | 54 | /// <summary> |
@@ -61,6 +62,8 @@ namespace OpenSim.Server.Handlers.Hypergrid | |||
61 | //string host = (string)requestData["host"]; | 62 | //string host = (string)requestData["host"]; |
62 | //string portstr = (string)requestData["port"]; | 63 | //string portstr = (string)requestData["port"]; |
63 | string name = (string)requestData["region_name"]; | 64 | string name = (string)requestData["region_name"]; |
65 | if (name == null) | ||
66 | name = string.Empty; | ||
64 | 67 | ||
65 | UUID regionID = UUID.Zero; | 68 | UUID regionID = UUID.Zero; |
66 | string externalName = string.Empty; | 69 | string externalName = string.Empty; |
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index a453d99..0ec8912 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs | |||
@@ -300,7 +300,7 @@ namespace OpenSim.Services.Connectors | |||
300 | if (replyData["result"] is Dictionary<string, object>) | 300 | if (replyData["result"] is Dictionary<string, object>) |
301 | rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); | 301 | rinfo = new GridRegion((Dictionary<string, object>)replyData["result"]); |
302 | else | 302 | else |
303 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received invalid response", | 303 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition {0}, {1}-{2} received no region", |
304 | scopeID, x, y); | 304 | scopeID, x, y); |
305 | } | 305 | } |
306 | else | 306 | else |
@@ -391,9 +391,6 @@ namespace OpenSim.Services.Connectors | |||
391 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); | 391 | GridRegion rinfo = new GridRegion((Dictionary<string, object>)r); |
392 | rinfos.Add(rinfo); | 392 | rinfos.Add(rinfo); |
393 | } | 393 | } |
394 | else | ||
395 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionsByName {0}, {1}, {2} received invalid response", | ||
396 | scopeID, name, maxNumber); | ||
397 | } | 394 | } |
398 | } | 395 | } |
399 | else | 396 | else |
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index 2faf018..4089fce 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -315,6 +315,8 @@ namespace OpenSim.Services.GridService | |||
315 | 315 | ||
316 | public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) | 316 | public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) |
317 | { | 317 | { |
318 | m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); | ||
319 | |||
318 | List<RegionData> rdatas = m_Database.Get("%" + name + "%", scopeID); | 320 | List<RegionData> rdatas = m_Database.Get("%" + name + "%", scopeID); |
319 | 321 | ||
320 | int count = 0; | 322 | int count = 0; |
@@ -329,7 +331,7 @@ namespace OpenSim.Services.GridService | |||
329 | } | 331 | } |
330 | } | 332 | } |
331 | 333 | ||
332 | if (m_AllowHypergridMapSearch && rdatas == null || (rdatas != null && rdatas.Count == 0) && name.Contains(".")) | 334 | if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0) && name.Contains("."))) |
333 | { | 335 | { |
334 | GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name); | 336 | GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name); |
335 | if (r != null) | 337 | if (r != null) |
@@ -397,6 +399,7 @@ namespace OpenSim.Services.GridService | |||
397 | ret.Add(RegionData2RegionInfo(r)); | 399 | ret.Add(RegionData2RegionInfo(r)); |
398 | } | 400 | } |
399 | 401 | ||
402 | m_log.DebugFormat("[GRID SERVICE]: GetDefaultRegions returning {0} regions", ret.Count); | ||
400 | return ret; | 403 | return ret; |
401 | } | 404 | } |
402 | 405 | ||
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 58746d0..af603b2 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -79,9 +79,16 @@ namespace OpenSim.Services.GridService | |||
79 | m_DefaultRegion = defs[0]; | 79 | m_DefaultRegion = defs[0]; |
80 | else | 80 | else |
81 | { | 81 | { |
82 | // Best guess, may be totally off | 82 | // Get any region |
83 | m_DefaultRegion = new GridRegion(1000, 1000); | 83 | defs = m_GridService.GetRegionsByName(m_ScopeID, "", 1); |
84 | m_log.WarnFormat("[HYPERGRID LINKER]: This grid does not have a default region. Assuming default coordinates at 1000, 1000."); | 84 | if (defs != null && defs.Count > 0) |
85 | m_DefaultRegion = defs[0]; | ||
86 | else | ||
87 | { | ||
88 | // This shouldn't happen | ||
89 | m_DefaultRegion = new GridRegion(1000, 1000); | ||
90 | m_log.Error("[HYPERGRID LINKER]: Something is wrong with this grid. It has no regions?"); | ||
91 | } | ||
85 | } | 92 | } |
86 | } | 93 | } |
87 | return m_DefaultRegion; | 94 | return m_DefaultRegion; |
@@ -90,7 +97,7 @@ namespace OpenSim.Services.GridService | |||
90 | 97 | ||
91 | public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db) | 98 | public HypergridLinker(IConfigSource config, GridService gridService, IRegionData db) |
92 | { | 99 | { |
93 | m_log.DebugFormat("[HYPERGRID LINKER]: Starting..."); | 100 | m_log.DebugFormat("[HYPERGRID LINKER]: Starting with db {0}", db.GetType()); |
94 | 101 | ||
95 | m_Database = db; | 102 | m_Database = db; |
96 | m_GridService = gridService; | 103 | m_GridService = gridService; |
@@ -196,7 +203,7 @@ namespace OpenSim.Services.GridService | |||
196 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, | 203 | public bool TryCreateLink(UUID scopeID, int xloc, int yloc, |
197 | string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) | 204 | string externalRegionName, uint externalPort, string externalHostName, out GridRegion regInfo, out string reason) |
198 | { | 205 | { |
199 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}, in {2}-{3}", externalHostName, externalPort, xloc, yloc); | 206 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0}:{1}:{2}, in {3}-{4}", externalHostName, externalPort, externalRegionName, xloc, yloc); |
200 | 207 | ||
201 | reason = string.Empty; | 208 | reason = string.Empty; |
202 | regInfo = new GridRegion(); | 209 | regInfo = new GridRegion(); |
@@ -280,29 +287,28 @@ namespace OpenSim.Services.GridService | |||
280 | 287 | ||
281 | public bool TryUnlinkRegion(string mapName) | 288 | public bool TryUnlinkRegion(string mapName) |
282 | { | 289 | { |
290 | m_log.DebugFormat("[HYPERGRID LINKER]: Request to unlink {0}", mapName); | ||
283 | GridRegion regInfo = null; | 291 | GridRegion regInfo = null; |
284 | if (mapName.Contains(":")) | 292 | |
293 | List<RegionData> regions = m_Database.Get(mapName, m_ScopeID); | ||
294 | if (regions != null && regions.Count > 0) | ||
285 | { | 295 | { |
286 | string host = "127.0.0.1"; | 296 | OpenSim.Data.RegionFlags rflags = (OpenSim.Data.RegionFlags)Convert.ToInt32(regions[0].Data["flags"]); |
287 | //string portstr; | 297 | if ((rflags & OpenSim.Data.RegionFlags.Hyperlink) != 0) |
288 | //string regionName = ""; | ||
289 | uint port = 9000; | ||
290 | string[] parts = mapName.Split(new char[] { ':' }); | ||
291 | if (parts.Length >= 1) | ||
292 | { | 298 | { |
293 | host = parts[0]; | 299 | regInfo = new GridRegion(); |
300 | regInfo.RegionID = regions[0].RegionID; | ||
301 | regInfo.ScopeID = m_ScopeID; | ||
294 | } | 302 | } |
295 | |||
296 | foreach (GridRegion r in m_HyperlinkRegions.Values) | ||
297 | if (host.Equals(r.ExternalHostName) && (port == r.HttpPort)) | ||
298 | regInfo = r; | ||
299 | } | ||
300 | else | ||
301 | { | ||
302 | foreach (GridRegion r in m_HyperlinkRegions.Values) | ||
303 | if (r.RegionName.Equals(mapName)) | ||
304 | regInfo = r; | ||
305 | } | 303 | } |
304 | |||
305 | //foreach (GridRegion r in m_HyperlinkRegions.Values) | ||
306 | //{ | ||
307 | // m_log.DebugFormat("XXX Comparing {0}:{1} with {2}:{3}", host, port, r.ExternalHostName, r.HttpPort); | ||
308 | // if (host.Equals(r.ExternalHostName) && (port == r.HttpPort)) | ||
309 | // regInfo = r; | ||
310 | //} | ||
311 | |||
306 | if (regInfo != null) | 312 | if (regInfo != null) |
307 | { | 313 | { |
308 | RemoveHyperlinkRegion(regInfo.RegionID); | 314 | RemoveHyperlinkRegion(regInfo.RegionID); |
diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 56744b6..c5cfe75 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs | |||
@@ -119,7 +119,8 @@ namespace OpenSim.Services.HypergridService | |||
119 | imageURL = string.Empty; | 119 | imageURL = string.Empty; |
120 | reason = string.Empty; | 120 | reason = string.Empty; |
121 | 121 | ||
122 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty ? "default region" : regionName)); | 122 | |
123 | m_log.DebugFormat("[GATEKEEPER SERVICE]: Request to link to {0}", (regionName == string.Empty)? "default region" : regionName); | ||
123 | if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty) | 124 | if (!m_AllowTeleportsToAnyRegion || regionName == string.Empty) |
124 | { | 125 | { |
125 | List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID); | 126 | List<GridRegion> defs = m_GridService.GetDefaultRegions(m_ScopeID); |