diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Application/Application.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Application/HGCommands.cs | 215 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 26 |
4 files changed, 22 insertions, 235 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 2fd26bf..241af53 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs | |||
@@ -91,7 +91,7 @@ namespace OpenSim | |||
91 | m_log.Info("[OPENSIM MAIN]: configured log4net using default OpenSim.exe.config"); | 91 | m_log.Info("[OPENSIM MAIN]: configured log4net using default OpenSim.exe.config"); |
92 | } | 92 | } |
93 | 93 | ||
94 | // Check if the system is compatible with OpenSimulator. | 94 | // Check if the system is compatible with OpenSimulator. |
95 | // Ensures that the minimum system requirements are met | 95 | // Ensures that the minimum system requirements are met |
96 | m_log.Info("Performing compatibility checks... "); | 96 | m_log.Info("Performing compatibility checks... "); |
97 | string supported = String.Empty; | 97 | string supported = String.Empty; |
diff --git a/OpenSim/Region/Application/HGCommands.cs b/OpenSim/Region/Application/HGCommands.cs index 1786e54..f503db7 100644 --- a/OpenSim/Region/Application/HGCommands.cs +++ b/OpenSim/Region/Application/HGCommands.cs | |||
@@ -43,16 +43,11 @@ namespace OpenSim | |||
43 | public class HGCommands | 43 | public class HGCommands |
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | public static IHyperlink HGServices = null; | ||
47 | |||
48 | private static uint m_autoMappingX = 0; | ||
49 | private static uint m_autoMappingY = 0; | ||
50 | private static bool m_enableAutoMapping = false; | ||
51 | 46 | ||
52 | public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager, | 47 | public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager, |
53 | StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version) | 48 | StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version) |
54 | { | 49 | { |
55 | HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager, HGServices); | 50 | HGSceneCommunicationService sceneGridService = new HGSceneCommunicationService(m_commsManager); |
56 | 51 | ||
57 | return | 52 | return |
58 | new HGScene( | 53 | new HGScene( |
@@ -61,213 +56,5 @@ namespace OpenSim | |||
61 | m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); | 56 | m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); |
62 | } | 57 | } |
63 | 58 | ||
64 | public static void RunHGCommand(string command, string[] cmdparams, Scene scene) | ||
65 | { | ||
66 | if (command.Equals("link-mapping")) | ||
67 | { | ||
68 | if (cmdparams.Length == 2) | ||
69 | { | ||
70 | try | ||
71 | { | ||
72 | m_autoMappingX = Convert.ToUInt32(cmdparams[0]); | ||
73 | m_autoMappingY = Convert.ToUInt32(cmdparams[1]); | ||
74 | m_enableAutoMapping = true; | ||
75 | } | ||
76 | catch (Exception) | ||
77 | { | ||
78 | m_autoMappingX = 0; | ||
79 | m_autoMappingY = 0; | ||
80 | m_enableAutoMapping = false; | ||
81 | } | ||
82 | } | ||
83 | } | ||
84 | else if (command.Equals("link-region")) | ||
85 | { | ||
86 | if (cmdparams.Length < 3) | ||
87 | { | ||
88 | if ((cmdparams.Length == 1) || (cmdparams.Length == 2)) | ||
89 | { | ||
90 | LoadXmlLinkFile(cmdparams, scene); | ||
91 | } | ||
92 | else | ||
93 | { | ||
94 | LinkRegionCmdUsage(); | ||
95 | } | ||
96 | return; | ||
97 | } | ||
98 | |||
99 | if (cmdparams[2].Contains(":")) | ||
100 | { | ||
101 | // New format | ||
102 | uint xloc, yloc; | ||
103 | string mapName; | ||
104 | try | ||
105 | { | ||
106 | xloc = Convert.ToUInt32(cmdparams[0]); | ||
107 | yloc = Convert.ToUInt32(cmdparams[1]); | ||
108 | mapName = cmdparams[2]; | ||
109 | if (cmdparams.Length > 3) | ||
110 | for (int i = 3; i < cmdparams.Length; i++) | ||
111 | mapName += " " + cmdparams[i]; | ||
112 | |||
113 | m_log.Info(">> MapName: " + mapName); | ||
114 | //internalPort = Convert.ToUInt32(cmdparams[4]); | ||
115 | //remotingPort = Convert.ToUInt32(cmdparams[5]); | ||
116 | } | ||
117 | catch (Exception e) | ||
118 | { | ||
119 | m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message); | ||
120 | LinkRegionCmdUsage(); | ||
121 | return; | ||
122 | } | ||
123 | |||
124 | HGHyperlink.TryLinkRegionToCoords(scene, null, mapName, xloc, yloc); | ||
125 | } | ||
126 | else | ||
127 | { | ||
128 | // old format | ||
129 | RegionInfo regInfo; | ||
130 | uint xloc, yloc; | ||
131 | uint externalPort; | ||
132 | string externalHostName; | ||
133 | try | ||
134 | { | ||
135 | xloc = Convert.ToUInt32(cmdparams[0]); | ||
136 | yloc = Convert.ToUInt32(cmdparams[1]); | ||
137 | externalPort = Convert.ToUInt32(cmdparams[3]); | ||
138 | externalHostName = cmdparams[2]; | ||
139 | //internalPort = Convert.ToUInt32(cmdparams[4]); | ||
140 | //remotingPort = Convert.ToUInt32(cmdparams[5]); | ||
141 | } | ||
142 | catch (Exception e) | ||
143 | { | ||
144 | m_log.Warn("[HGrid] Wrong format for link-region command: " + e.Message); | ||
145 | LinkRegionCmdUsage(); | ||
146 | return; | ||
147 | } | ||
148 | |||
149 | //if (TryCreateLink(xloc, yloc, externalPort, externalHostName, out regInfo)) | ||
150 | if (HGHyperlink.TryCreateLink(scene, null, xloc, yloc, "", externalPort, externalHostName, out regInfo)) | ||
151 | { | ||
152 | if (cmdparams.Length >= 5) | ||
153 | { | ||
154 | regInfo.RegionName = ""; | ||
155 | for (int i = 4; i < cmdparams.Length; i++) | ||
156 | regInfo.RegionName += cmdparams[i] + " "; | ||
157 | } | ||
158 | } | ||
159 | } | ||
160 | return; | ||
161 | } | ||
162 | else if (command.Equals("unlink-region")) | ||
163 | { | ||
164 | if (cmdparams.Length < 1) | ||
165 | { | ||
166 | UnlinkRegionCmdUsage(); | ||
167 | return; | ||
168 | } | ||
169 | if (HGHyperlink.TryUnlinkRegion(scene, cmdparams[0])) | ||
170 | m_log.InfoFormat("[HGrid]: Successfully unlinked {0}", cmdparams[0]); | ||
171 | else | ||
172 | m_log.InfoFormat("[HGrid]: Unable to unlink {0}, region not found", cmdparams[0]); | ||
173 | } | ||
174 | } | ||
175 | |||
176 | private static void LoadXmlLinkFile(string[] cmdparams, Scene scene) | ||
177 | { | ||
178 | //use http://www.hgurl.com/hypergrid.xml for test | ||
179 | try | ||
180 | { | ||
181 | XmlReader r = XmlReader.Create(cmdparams[0]); | ||
182 | XmlConfigSource cs = new XmlConfigSource(r); | ||
183 | string[] excludeSections = null; | ||
184 | |||
185 | if (cmdparams.Length == 2) | ||
186 | { | ||
187 | if (cmdparams[1].ToLower().StartsWith("excludelist:")) | ||
188 | { | ||
189 | string excludeString = cmdparams[1].ToLower(); | ||
190 | excludeString = excludeString.Remove(0, 12); | ||
191 | char[] splitter = {';'}; | ||
192 | |||
193 | excludeSections = excludeString.Split(splitter); | ||
194 | } | ||
195 | } | ||
196 | |||
197 | for (int i = 0; i < cs.Configs.Count; i++) | ||
198 | { | ||
199 | bool skip = false; | ||
200 | if ((excludeSections != null) && (excludeSections.Length > 0)) | ||
201 | { | ||
202 | for (int n = 0; n < excludeSections.Length; n++) | ||
203 | { | ||
204 | if (excludeSections[n] == cs.Configs[i].Name.ToLower()) | ||
205 | { | ||
206 | skip = true; | ||
207 | break; | ||
208 | } | ||
209 | } | ||
210 | } | ||
211 | if (!skip) | ||
212 | { | ||
213 | ReadLinkFromConfig(cs.Configs[i], scene); | ||
214 | } | ||
215 | } | ||
216 | } | ||
217 | catch (Exception e) | ||
218 | { | ||
219 | m_log.Error(e.ToString()); | ||
220 | } | ||
221 | } | ||
222 | |||
223 | |||
224 | private static void ReadLinkFromConfig(IConfig config, Scene scene) | ||
225 | { | ||
226 | RegionInfo regInfo; | ||
227 | uint xloc, yloc; | ||
228 | uint externalPort; | ||
229 | string externalHostName; | ||
230 | uint realXLoc, realYLoc; | ||
231 | |||
232 | xloc = Convert.ToUInt32(config.GetString("xloc", "0")); | ||
233 | yloc = Convert.ToUInt32(config.GetString("yloc", "0")); | ||
234 | externalPort = Convert.ToUInt32(config.GetString("externalPort", "0")); | ||
235 | externalHostName = config.GetString("externalHostName", ""); | ||
236 | realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0")); | ||
237 | realYLoc = Convert.ToUInt32(config.GetString("real-yloc", "0")); | ||
238 | |||
239 | if (m_enableAutoMapping) | ||
240 | { | ||
241 | xloc = (uint) ((xloc%100) + m_autoMappingX); | ||
242 | yloc = (uint) ((yloc%100) + m_autoMappingY); | ||
243 | } | ||
244 | |||
245 | if (((realXLoc == 0) && (realYLoc == 0)) || | ||
246 | (((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) && | ||
247 | ((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896)))) | ||
248 | { | ||
249 | if ( | ||
250 | HGHyperlink.TryCreateLink(scene, null, xloc, yloc, "", externalPort, | ||
251 | externalHostName, out regInfo)) | ||
252 | { | ||
253 | regInfo.RegionName = config.GetString("localName", ""); | ||
254 | } | ||
255 | } | ||
256 | } | ||
257 | |||
258 | |||
259 | private static void LinkRegionCmdUsage() | ||
260 | { | ||
261 | m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName>:<HttpPort>[:<RemoteRegionName>]"); | ||
262 | m_log.Info("Usage: link-region <Xloc> <Yloc> <HostName> <HttpPort> [<LocalName>]"); | ||
263 | m_log.Info("Usage: link-region <URI_of_xml> [<exclude>]"); | ||
264 | } | ||
265 | |||
266 | private static void UnlinkRegionCmdUsage() | ||
267 | { | ||
268 | m_log.Info("Usage: unlink-region <HostName>:<HttpPort>"); | ||
269 | m_log.Info("Usage: unlink-region <LocalName>"); | ||
270 | } | ||
271 | |||
272 | } | 59 | } |
273 | } | 60 | } |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index b23cdc3..4d8409bb 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -493,7 +493,7 @@ namespace OpenSim | |||
493 | { | 493 | { |
494 | if (cmd.Length < 4) | 494 | if (cmd.Length < 4) |
495 | { | 495 | { |
496 | m_log.Error("Usage: create region <region name> <region_file.xml>"); | 496 | m_log.Error("Usage: create region <region name> <region_file.ini>"); |
497 | return; | 497 | return; |
498 | } | 498 | } |
499 | if (cmd[3].EndsWith(".xml")) | 499 | if (cmd[3].EndsWith(".xml")) |
@@ -520,7 +520,7 @@ namespace OpenSim | |||
520 | } | 520 | } |
521 | else | 521 | else |
522 | { | 522 | { |
523 | m_log.Error("Usage: create region <region name> <region_file.xml>"); | 523 | m_log.Error("Usage: create region <region name> <region_file.ini>"); |
524 | return; | 524 | return; |
525 | } | 525 | } |
526 | } | 526 | } |
@@ -553,7 +553,7 @@ namespace OpenSim | |||
553 | /// <param name="cmd"></param> | 553 | /// <param name="cmd"></param> |
554 | private void HandleLoginStatus(string module, string[] cmd) | 554 | private void HandleLoginStatus(string module, string[] cmd) |
555 | { | 555 | { |
556 | if (m_commsManager.GridService.RegionLoginsEnabled == false) | 556 | if (m_sceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled == false) |
557 | 557 | ||
558 | m_log.Info("[ Login ] Login are disabled "); | 558 | m_log.Info("[ Login ] Login are disabled "); |
559 | else | 559 | else |
@@ -1230,20 +1230,20 @@ namespace OpenSim | |||
1230 | protected void LoadOar(string module, string[] cmdparams) | 1230 | protected void LoadOar(string module, string[] cmdparams) |
1231 | { | 1231 | { |
1232 | try | 1232 | try |
1233 | { | 1233 | { |
1234 | if (cmdparams.Length > 2) | 1234 | if (cmdparams.Length > 2) |
1235 | { | 1235 | { |
1236 | m_sceneManager.LoadArchiveToCurrentScene(cmdparams[2]); | 1236 | m_sceneManager.LoadArchiveToCurrentScene(cmdparams[2]); |
1237 | } | 1237 | } |
1238 | else | 1238 | else |
1239 | { | 1239 | { |
1240 | m_sceneManager.LoadArchiveToCurrentScene(DEFAULT_OAR_BACKUP_FILENAME); | 1240 | m_sceneManager.LoadArchiveToCurrentScene(DEFAULT_OAR_BACKUP_FILENAME); |
1241 | } | 1241 | } |
1242 | } | 1242 | } |
1243 | catch (Exception e) | 1243 | catch (Exception e) |
1244 | { | 1244 | { |
1245 | m_log.Error(e.Message); | 1245 | m_log.Error(e.Message); |
1246 | } | 1246 | } |
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | /// <summary> | 1249 | /// <summary> |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 7bc0b77..468c5d7 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -98,7 +98,7 @@ namespace OpenSim | |||
98 | 98 | ||
99 | /// <value> | 99 | /// <value> |
100 | /// The config information passed into the OpenSimulator region server. | 100 | /// The config information passed into the OpenSimulator region server. |
101 | /// </value> | 101 | /// </value> |
102 | public OpenSimConfigSource ConfigSource | 102 | public OpenSimConfigSource ConfigSource |
103 | { | 103 | { |
104 | get { return m_config; } | 104 | get { return m_config; } |
@@ -209,9 +209,9 @@ namespace OpenSim | |||
209 | } | 209 | } |
210 | 210 | ||
211 | // Only enable logins to the regions once we have completely finished starting up (apart from scripts) | 211 | // Only enable logins to the regions once we have completely finished starting up (apart from scripts) |
212 | if ((m_commsManager != null) && (m_commsManager.GridService != null)) | 212 | if ((SceneManager.CurrentOrFirstScene != null) && (SceneManager.CurrentOrFirstScene.SceneGridService != null)) |
213 | { | 213 | { |
214 | m_commsManager.GridService.RegionLoginsEnabled = true; | 214 | SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true; |
215 | } | 215 | } |
216 | 216 | ||
217 | AddPluginCommands(); | 217 | AddPluginCommands(); |
@@ -299,12 +299,12 @@ namespace OpenSim | |||
299 | if (LoginEnabled) | 299 | if (LoginEnabled) |
300 | { | 300 | { |
301 | m_log.Info("[LOGIN]: Login is now enabled."); | 301 | m_log.Info("[LOGIN]: Login is now enabled."); |
302 | m_commsManager.GridService.RegionLoginsEnabled = true; | 302 | SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = true; |
303 | } | 303 | } |
304 | else | 304 | else |
305 | { | 305 | { |
306 | m_log.Info("[LOGIN]: Login is now disabled."); | 306 | m_log.Info("[LOGIN]: Login is now disabled."); |
307 | m_commsManager.GridService.RegionLoginsEnabled = false; | 307 | SceneManager.CurrentOrFirstScene.SceneGridService.RegionLoginsEnabled = false; |
308 | } | 308 | } |
309 | } | 309 | } |
310 | 310 | ||
@@ -383,14 +383,14 @@ namespace OpenSim | |||
383 | 383 | ||
384 | scene.SetModuleInterfaces(); | 384 | scene.SetModuleInterfaces(); |
385 | 385 | ||
386 | // Prims have to be loaded after module configuration since some modules may be invoked during the load | 386 | // Prims have to be loaded after module configuration since some modules may be invoked during the load |
387 | scene.LoadPrimsFromStorage(regionInfo.originRegionID); | 387 | scene.LoadPrimsFromStorage(regionInfo.originRegionID); |
388 | 388 | ||
389 | // moved these here as the terrain texture has to be created after the modules are initialized | 389 | // moved these here as the terrain texture has to be created after the modules are initialized |
390 | // and has to happen before the region is registered with the grid. | 390 | // and has to happen before the region is registered with the grid. |
391 | scene.CreateTerrainTexture(false); | 391 | scene.CreateTerrainTexture(false); |
392 | 392 | ||
393 | // TODO : Try setting resource for region xstats here on scene | 393 | // TODO : Try setting resource for region xstats here on scene |
394 | MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo)); | 394 | MainServer.Instance.AddStreamHandler(new Region.Framework.Scenes.RegionStatsHandler(regionInfo)); |
395 | 395 | ||
396 | try | 396 | try |
@@ -399,7 +399,7 @@ namespace OpenSim | |||
399 | } | 399 | } |
400 | catch (Exception e) | 400 | catch (Exception e) |
401 | { | 401 | { |
402 | m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e); | 402 | m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e.StackTrace); |
403 | 403 | ||
404 | // Carrying on now causes a lot of confusion down the | 404 | // Carrying on now causes a lot of confusion down the |
405 | // line - we need to get the user's attention | 405 | // line - we need to get the user's attention |
@@ -507,7 +507,7 @@ namespace OpenSim | |||
507 | /// Remove a region from the simulator without deleting it permanently. | 507 | /// Remove a region from the simulator without deleting it permanently. |
508 | /// </summary> | 508 | /// </summary> |
509 | /// <param name="scene"></param> | 509 | /// <param name="scene"></param> |
510 | /// <returns></returns> | 510 | /// <returns></returns> |
511 | public void CloseRegion(Scene scene) | 511 | public void CloseRegion(Scene scene) |
512 | { | 512 | { |
513 | // only need to check this if we are not at the | 513 | // only need to check this if we are not at the |
@@ -526,7 +526,7 @@ namespace OpenSim | |||
526 | /// Remove a region from the simulator without deleting it permanently. | 526 | /// Remove a region from the simulator without deleting it permanently. |
527 | /// </summary> | 527 | /// </summary> |
528 | /// <param name="name"></param> | 528 | /// <param name="name"></param> |
529 | /// <returns></returns> | 529 | /// <returns></returns> |
530 | public void CloseRegion(string name) | 530 | public void CloseRegion(string name) |
531 | { | 531 | { |
532 | Scene target; | 532 | Scene target; |
@@ -539,7 +539,7 @@ namespace OpenSim | |||
539 | /// </summary> | 539 | /// </summary> |
540 | /// <param name="regionInfo"></param> | 540 | /// <param name="regionInfo"></param> |
541 | /// <param name="clientServer"> </param> | 541 | /// <param name="clientServer"> </param> |
542 | /// <returns></returns> | 542 | /// <returns></returns> |
543 | protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer) | 543 | protected Scene SetupScene(RegionInfo regionInfo, out IClientNetworkServer clientServer) |
544 | { | 544 | { |
545 | return SetupScene(regionInfo, 0, null, out clientServer); | 545 | return SetupScene(regionInfo, 0, null, out clientServer); |
@@ -750,7 +750,7 @@ namespace OpenSim | |||
750 | } | 750 | } |
751 | 751 | ||
752 | public string Path | 752 | public string Path |
753 | { | 753 | { |
754 | // This is for the OpenSimulator instance and is the osSecret hashed | 754 | // This is for the OpenSimulator instance and is the osSecret hashed |
755 | get { return "/" + osXStatsURI + "/"; } | 755 | get { return "/" + osXStatsURI + "/"; } |
756 | } | 756 | } |
@@ -791,7 +791,7 @@ namespace OpenSim | |||
791 | } | 791 | } |
792 | 792 | ||
793 | public string Path | 793 | public string Path |
794 | { | 794 | { |
795 | // This is for the OpenSimulator instance and is the user provided URI | 795 | // This is for the OpenSimulator instance and is the user provided URI |
796 | get { return "/" + osUXStatsURI + "/"; } | 796 | get { return "/" + osUXStatsURI + "/"; } |
797 | } | 797 | } |