aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authordiva2009-03-18 16:37:26 +0000
committerdiva2009-03-18 16:37:26 +0000
commita7d610ffcca8d707c7f9e9fdd7ad1477981ec2a9 (patch)
tree4f8a0c98e680fba6af670650993ecebdad4c8de2 /OpenSim
parentAdd an event to process undelivered IMs (diff)
downloadopensim-SC_OLD-a7d610ffcca8d707c7f9e9fdd7ad1477981ec2a9.zip
opensim-SC_OLD-a7d610ffcca8d707c7f9e9fdd7ad1477981ec2a9.tar.gz
opensim-SC_OLD-a7d610ffcca8d707c7f9e9fdd7ad1477981ec2a9.tar.bz2
opensim-SC_OLD-a7d610ffcca8d707c7f9e9fdd7ad1477981ec2a9.tar.xz
Adds support for unlink-region command in hypergrid.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/IGridServices.cs3
-rw-r--r--OpenSim/Region/Application/HGOpenSimNode.cs22
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGGridServices.cs41
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs32
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGHyperlink.cs42
6 files changed, 162 insertions, 0 deletions
diff --git a/OpenSim/Framework/Communications/IGridServices.cs b/OpenSim/Framework/Communications/IGridServices.cs
index 69e8756..fa4d8d0 100644
--- a/OpenSim/Framework/Communications/IGridServices.cs
+++ b/OpenSim/Framework/Communications/IGridServices.cs
@@ -65,6 +65,9 @@ namespace OpenSim.Framework.Communications
65 65
66 RegionInfo RequestNeighbourInfo(ulong regionHandle); 66 RegionInfo RequestNeighbourInfo(ulong regionHandle);
67 RegionInfo RequestNeighbourInfo(UUID regionID); 67 RegionInfo RequestNeighbourInfo(UUID regionID);
68 RegionInfo RequestNeighbourInfo(string name);
69 RegionInfo RequestNeighbourInfo(string host, uint port);
70
68 RegionInfo RequestClosestRegion(string regionName); 71 RegionInfo RequestClosestRegion(string regionName);
69 Dictionary<string, string> GetGridSettings(); 72 Dictionary<string, string> GetGridSettings();
70 List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY); 73 List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY);
diff --git a/OpenSim/Region/Application/HGOpenSimNode.cs b/OpenSim/Region/Application/HGOpenSimNode.cs
index 6e7f1c5..f4f3062 100644
--- a/OpenSim/Region/Application/HGOpenSimNode.cs
+++ b/OpenSim/Region/Application/HGOpenSimNode.cs
@@ -69,6 +69,9 @@ namespace OpenSim
69 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region", 69 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "link-region",
70 "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>", 70 "link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>] <cr>",
71 "Link a hypergrid region", RunCommand); 71 "Link a hypergrid region", RunCommand);
72 MainConsole.Instance.Commands.AddCommand("hypergrid", false, "unlink-region",
73 "unlink-region <local name> or <HostName>:<HttpPort> <cr>",
74 "Unlink a hypergrid region", RunCommand);
72 } 75 }
73 76
74 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, 77 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
@@ -188,6 +191,18 @@ namespace OpenSim
188 } 191 }
189 return; 192 return;
190 } 193 }
194 else if (command.Equals("unlink-region"))
195 {
196 if (cmdparams.Count < 1)
197 {
198 UnlinkRegionCmdUsage();
199 return;
200 }
201 if (HGHyperlink.TryUnlinkRegion(m_sceneManager.CurrentOrFirstScene, cmdparams[0]))
202 m_log.InfoFormat("[HGrid]: Successfully unlinked {0}", cmdparams[0]);
203 else
204 m_log.InfoFormat("[HGrid]: Unable to unlink {0}, region not found", cmdparams[0]);
205 }
191 } 206 }
192 207
193 private void LoadXmlLinkFile(List<string> cmdparams) 208 private void LoadXmlLinkFile(List<string> cmdparams)
@@ -279,5 +294,12 @@ namespace OpenSim
279 m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]"); 294 m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]");
280 m_log.Info("Usage: link-region <URI_of_xml> [<exclude>]"); 295 m_log.Info("Usage: link-region <URI_of_xml> [<exclude>]");
281 } 296 }
297
298 private void UnlinkRegionCmdUsage()
299 {
300 m_log.Info("Usage: unlink-region <HostName>:<HttpPort>");
301 m_log.Info("Usage: unlink-region <LocalName>");
302 }
303
282 } 304 }
283} \ No newline at end of file 305} \ No newline at end of file
diff --git a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
index 4493591..5b3343a 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGGridServices.cs
@@ -258,6 +258,47 @@ namespace OpenSim.Region.Communications.Hypergrid
258 return null; 258 return null;
259 } 259 }
260 260
261 public virtual RegionInfo RequestNeighbourInfo(string name)
262 {
263 foreach (RegionInfo info in m_hyperlinkRegions)
264 {
265 //m_log.Debug(" .. " + info.RegionHandle);
266 if (info.RegionName == name) return info;
267 }
268
269 foreach (RegionInfo info in m_knownRegions.Values)
270 {
271 if (info.RegionName == name)
272 {
273 //m_log.Debug("XXX------ known region " + info.RegionHandle);
274 return info;
275 }
276 }
277
278 return null;
279 }
280
281 public virtual RegionInfo RequestNeighbourInfo(string hostName, uint port)
282 {
283 foreach (RegionInfo info in m_hyperlinkRegions)
284 {
285 //m_log.Debug(" .. " + info.RegionHandle);
286 if ((info.ExternalHostName == hostName) && (info.HttpPort == port))
287 return info;
288 }
289
290 foreach (RegionInfo info in m_knownRegions.Values)
291 {
292 if ((info.ExternalHostName == hostName) && (info.HttpPort == port))
293 {
294 //m_log.Debug("XXX------ known region " + info.RegionHandle);
295 return info;
296 }
297 }
298
299 return null;
300 }
301
261 public virtual RegionInfo RequestClosestRegion(string regionName) 302 public virtual RegionInfo RequestClosestRegion(string regionName)
262 { 303 {
263 foreach (RegionInfo info in m_hyperlinkRegions) 304 foreach (RegionInfo info in m_hyperlinkRegions)
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 33bc2fa..c52f825 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -199,6 +199,38 @@ namespace OpenSim.Region.Communications.Local
199 } 199 }
200 200
201 /// <summary> 201 /// <summary>
202 /// Get information about a neighbouring region
203 /// </summary>
204 /// <param name="regionHandle"></param>
205 /// <returns></returns>
206 public RegionInfo RequestNeighbourInfo(string name)
207 {
208 foreach (RegionInfo info in m_regions.Values)
209 {
210 if (info.RegionName == name)
211 return info;
212 }
213
214 return null;
215 }
216
217 /// <summary>
218 /// Get information about a neighbouring region
219 /// </summary>
220 /// <param name="regionHandle"></param>
221 /// <returns></returns>
222 public RegionInfo RequestNeighbourInfo(string host, uint port)
223 {
224 foreach (RegionInfo info in m_regions.Values)
225 {
226 if ((info.ExternalHostName == host) && (info.HttpPort == port))
227 return info;
228 }
229
230 return null;
231 }
232
233 /// <summary>
202 /// Get information about the closet region given a region name. 234 /// Get information about the closet region given a region name.
203 /// </summary> 235 /// </summary>
204 /// <param name="regionName"></param> 236 /// <param name="regionName"></param>
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index a397093..f47abe8 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -445,6 +445,28 @@ namespace OpenSim.Region.Communications.OGS1
445 return regionInfo; 445 return regionInfo;
446 } 446 }
447 447
448 /// <summary>
449 /// Get information about a neighbouring region
450 /// </summary>
451 /// <param name="regionHandle"></param>
452 /// <returns></returns>
453 public RegionInfo RequestNeighbourInfo(string name)
454 {
455 // Not implemented yet
456 return null;
457 }
458
459 /// <summary>
460 /// Get information about a neighbouring region
461 /// </summary>
462 /// <param name="regionHandle"></param>
463 /// <returns></returns>
464 public RegionInfo RequestNeighbourInfo(string host, uint port)
465 {
466 // Not implemented yet
467 return null;
468 }
469
448 public RegionInfo RequestClosestRegion(string regionName) 470 public RegionInfo RequestClosestRegion(string regionName)
449 { 471 {
450 foreach (RegionInfo ri in m_remoteRegionInfoCache.Values) 472 foreach (RegionInfo ri in m_remoteRegionInfoCache.Values)
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGHyperlink.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGHyperlink.cs
index ad98273..e05b001 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGHyperlink.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGHyperlink.cs
@@ -149,6 +149,48 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
149 return true; 149 return true;
150 } 150 }
151 151
152 public static bool TryUnlinkRegion(Scene m_scene, string mapName)
153 {
154 RegionInfo regInfo = null;
155 if (mapName.Contains(":"))
156 {
157 string host = "127.0.0.1";
158 string portstr;
159 string regionName = "";
160 uint port = 9000;
161 string[] parts = mapName.Split(new char[] { ':' });
162 if (parts.Length >= 1)
163 {
164 host = parts[0];
165 }
166 if (parts.Length >= 2)
167 {
168 portstr = parts[1];
169 if (!UInt32.TryParse(portstr, out port))
170 regionName = parts[1];
171 }
172 // always take the last one
173 if (parts.Length >= 3)
174 {
175 regionName = parts[2];
176 }
177 regInfo = m_scene.CommsManager.GridService.RequestNeighbourInfo(host, port);
178 }
179 else
180 {
181 regInfo = m_scene.CommsManager.GridService.RequestNeighbourInfo(mapName);
182 }
183 if (regInfo != null)
184 {
185 return m_scene.CommsManager.GridService.DeregisterRegion(regInfo);
186 }
187 else
188 {
189 m_log.InfoFormat("[HGrid]: Region {0} not found", mapName);
190 return false;
191 }
192 }
193
152 /// <summary> 194 /// <summary>
153 /// Cope with this viewer limitation. 195 /// Cope with this viewer limitation.
154 /// </summary> 196 /// </summary>