diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 79 |
1 files changed, 60 insertions, 19 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 587d940..d808a88 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -130,20 +130,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
130 | } | 130 | } |
131 | 131 | ||
132 | protected readonly LandManager m_LandManager; | 132 | protected readonly LandManager m_LandManager; |
133 | 133 | // LandManager object instance that manages land related things. Parcel, primcounts etc.. | |
134 | public LandManager LandManager | 134 | public LandManager LandManager |
135 | { | 135 | { |
136 | get { return m_LandManager; } | 136 | get { return m_LandManager; } |
137 | } | 137 | } |
138 | 138 | ||
139 | protected readonly EstateManager m_estateManager; | 139 | protected readonly EstateManager m_estateManager; |
140 | 140 | // an instance to the physics plugin's Scene object. | |
141 | public PhysicsScene PhysicsScene | 141 | public PhysicsScene PhysicsScene |
142 | { | 142 | { |
143 | set { m_innerScene.PhysicsScene = value; } | 143 | set { m_innerScene.PhysicsScene = value; } |
144 | get { return (m_innerScene.PhysicsScene); } | 144 | get { return (m_innerScene.PhysicsScene); } |
145 | } | 145 | } |
146 | 146 | // This gets locked so things stay thread safe. | |
147 | public object SyncRoot | 147 | public object SyncRoot |
148 | { | 148 | { |
149 | get { return m_innerScene.m_syncRoot; } | 149 | get { return m_innerScene.m_syncRoot; } |
@@ -160,6 +160,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
160 | } | 160 | } |
161 | 161 | ||
162 | protected readonly PermissionManager m_permissionManager; | 162 | protected readonly PermissionManager m_permissionManager; |
163 | // This is the instance to the permissions manager. | ||
164 | // This manages permissions to clients on in world objects | ||
163 | 165 | ||
164 | public PermissionManager PermissionsMngr | 166 | public PermissionManager PermissionsMngr |
165 | { | 167 | { |
@@ -171,11 +173,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
171 | get { return m_timePhase; } | 173 | get { return m_timePhase; } |
172 | } | 174 | } |
173 | 175 | ||
176 | // Local reference to the objects in the scene (which are held in innerScene) | ||
174 | public Dictionary<LLUUID, SceneObjectGroup> Objects | 177 | public Dictionary<LLUUID, SceneObjectGroup> Objects |
175 | { | 178 | { |
176 | get { return m_innerScene.SceneObjects; } | 179 | get { return m_innerScene.SceneObjects; } |
177 | } | 180 | } |
178 | 181 | ||
182 | // Reference to all of the agents in the scene (root and child) | ||
179 | protected Dictionary<LLUUID, ScenePresence> m_scenePresences | 183 | protected Dictionary<LLUUID, ScenePresence> m_scenePresences |
180 | { | 184 | { |
181 | get { return m_innerScene.ScenePresences; } | 185 | get { return m_innerScene.ScenePresences; } |
@@ -267,9 +271,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
267 | 271 | ||
268 | public override bool OtherRegionUp(RegionInfo otherRegion) | 272 | public override bool OtherRegionUp(RegionInfo otherRegion) |
269 | { | 273 | { |
270 | // Another region is up. | 274 | // Another region is up. |
271 | // We have to tell all our ScenePresences about it.. | 275 | // Gets called from Grid Comms (SceneCommunicationService<---RegionListener<----LocalBackEnd<----OGS1) |
272 | // and add it to the neighbor list. | 276 | // We have to tell all our ScenePresences about it.. |
277 | // and add it to the neighbor list. | ||
273 | 278 | ||
274 | // We only add it to the neighbor list if it's within 1 region from here. | 279 | // We only add it to the neighbor list if it's within 1 region from here. |
275 | // Agents may have draw distance values that cross two regions though, so | 280 | // Agents may have draw distance values that cross two regions though, so |
@@ -324,8 +329,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
324 | return true; | 329 | return true; |
325 | } | 330 | } |
326 | 331 | ||
332 | // Given float seconds, this will restart the region. | ||
333 | |||
327 | public virtual void Restart(float seconds) | 334 | public virtual void Restart(float seconds) |
328 | { | 335 | { |
336 | // notifications are done in 15 second increments | ||
337 | // so .. if the number of seconds is less then 15 seconds, it's not really a restart request | ||
338 | // It's a 'Cancel restart' request. | ||
339 | |||
340 | // RestartNow() does immediate restarting. | ||
329 | if (seconds < 15) | 341 | if (seconds < 15) |
330 | { | 342 | { |
331 | m_restartTimer.Stop(); | 343 | m_restartTimer.Stop(); |
@@ -333,6 +345,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
333 | } | 345 | } |
334 | else | 346 | else |
335 | { | 347 | { |
348 | // Now we figure out what to set the timer to that does the notifications and calls, RestartNow() | ||
336 | m_restartTimer.Interval = 15000; | 349 | m_restartTimer.Interval = 15000; |
337 | m_incrementsof15seconds = (int) seconds/15; | 350 | m_incrementsof15seconds = (int) seconds/15; |
338 | m_RestartTimerCounter = 0; | 351 | m_RestartTimerCounter = 0; |
@@ -344,6 +357,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
344 | } | 357 | } |
345 | } | 358 | } |
346 | 359 | ||
360 | // The Restart timer has occured. | ||
361 | // We have to figure out if this is a notification or if the number of seconds specified in Restart | ||
362 | // have elapsed. | ||
363 | // If they have elapsed, call RestartNow() | ||
347 | public void RestartTimer_Elapsed(object sender, ElapsedEventArgs e) | 364 | public void RestartTimer_Elapsed(object sender, ElapsedEventArgs e) |
348 | { | 365 | { |
349 | m_RestartTimerCounter++; | 366 | m_RestartTimerCounter++; |
@@ -360,6 +377,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
360 | } | 377 | } |
361 | } | 378 | } |
362 | 379 | ||
380 | // This causes the region to restart immediatley. | ||
363 | public void RestartNow() | 381 | public void RestartNow() |
364 | { | 382 | { |
365 | MainLog.Instance.Error("REGION", "Closing"); | 383 | MainLog.Instance.Error("REGION", "Closing"); |
@@ -368,6 +386,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
368 | base.Restart(0); | 386 | base.Restart(0); |
369 | } | 387 | } |
370 | 388 | ||
389 | // This is a helper function that notifies root agents in this region that a new sim near them has come up | ||
390 | // This is in the form of a timer because when an instance of OpenSim.exe is started, | ||
391 | // Even though the sims initialize, they don't listen until 'all of the sims are initialized' | ||
392 | // If we tell an agent about a sim that's not listening yet, the agent will not be able to connect to it. | ||
393 | // subsequently the agent will never see the region come back online. | ||
371 | public void RestartNotifyWaitElapsed(object sender, ElapsedEventArgs e) | 394 | public void RestartNotifyWaitElapsed(object sender, ElapsedEventArgs e) |
372 | { | 395 | { |
373 | m_restartWaitTimer.Stop(); | 396 | m_restartWaitTimer.Stop(); |
@@ -378,6 +401,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
378 | 401 | ||
379 | ForEachScenePresence(delegate(ScenePresence agent) | 402 | ForEachScenePresence(delegate(ScenePresence agent) |
380 | { | 403 | { |
404 | // If agent is a root agent. | ||
381 | if (!agent.IsChildAgent) | 405 | if (!agent.IsChildAgent) |
382 | { | 406 | { |
383 | //agent.ControllingClient.new | 407 | //agent.ControllingClient.new |
@@ -391,14 +415,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
391 | catch (System.NullReferenceException) | 415 | catch (System.NullReferenceException) |
392 | { | 416 | { |
393 | // This means that we're not booted up completely yet. | 417 | // This means that we're not booted up completely yet. |
418 | // This shouldn't happen too often anymore. | ||
394 | } | 419 | } |
395 | } | 420 | } |
421 | |||
396 | // Reset list to nothing. | 422 | // Reset list to nothing. |
397 | m_regionRestartNotifyList.Clear(); | 423 | m_regionRestartNotifyList.Clear(); |
398 | } | 424 | } |
399 | 425 | ||
426 | // This is the method that shuts down the scene. | ||
400 | public override void Close() | 427 | public override void Close() |
401 | { | 428 | { |
429 | // Kick all ROOT agents with the message, 'The simulator is going down' | ||
402 | ForEachScenePresence(delegate(ScenePresence avatar) | 430 | ForEachScenePresence(delegate(ScenePresence avatar) |
403 | { | 431 | { |
404 | if (avatar.KnownChildRegions.Contains(RegionInfo.RegionHandle)) | 432 | if (avatar.KnownChildRegions.Contains(RegionInfo.RegionHandle)) |
@@ -409,18 +437,23 @@ namespace OpenSim.Region.Environment.Scenes | |||
409 | 437 | ||
410 | avatar.ControllingClient.OutPacket(new libsecondlife.Packets.DisableSimulatorPacket(), ThrottleOutPacketType.Task); | 438 | avatar.ControllingClient.OutPacket(new libsecondlife.Packets.DisableSimulatorPacket(), ThrottleOutPacketType.Task); |
411 | }); | 439 | }); |
412 | 440 | ||
441 | // Wait here, or the kick messages won't actually get to the agents before the scene terminates. | ||
413 | Thread.Sleep(500); | 442 | Thread.Sleep(500); |
414 | 443 | ||
444 | // Stop all client threads. | ||
415 | ForEachScenePresence(delegate(ScenePresence avatar) | 445 | ForEachScenePresence(delegate(ScenePresence avatar) |
416 | { | 446 | { |
417 | avatar.ControllingClient.Stop(); | 447 | avatar.ControllingClient.Stop(); |
418 | }); | 448 | }); |
419 | 449 | // Stop updating the scene objects and agents. | |
420 | m_heartbeatTimer.Close(); | 450 | m_heartbeatTimer.Close(); |
451 | // close the inner scene | ||
421 | m_innerScene.Close(); | 452 | m_innerScene.Close(); |
453 | // De-register with region communications (events cleanup) | ||
422 | UnRegisterReginWithComms(); | 454 | UnRegisterReginWithComms(); |
423 | 455 | ||
456 | // Shut down all non shared modules. | ||
424 | foreach (IRegionModule module in Modules.Values) | 457 | foreach (IRegionModule module in Modules.Values) |
425 | { | 458 | { |
426 | if (!module.IsSharedModule) | 459 | if (!module.IsSharedModule) |
@@ -430,6 +463,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
430 | } | 463 | } |
431 | Modules.Clear(); | 464 | Modules.Clear(); |
432 | 465 | ||
466 | // call the base class Close method. | ||
433 | base.Close(); | 467 | base.Close(); |
434 | } | 468 | } |
435 | 469 | ||
@@ -530,7 +564,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
530 | m_lastupdate = DateTime.Now; | 564 | m_lastupdate = DateTime.Now; |
531 | } | 565 | } |
532 | } | 566 | } |
533 | 567 | //Updates the time in the viewer. | |
534 | private void UpdateInWorldTime() | 568 | private void UpdateInWorldTime() |
535 | { | 569 | { |
536 | m_timeUpdateCount++; | 570 | m_timeUpdateCount++; |
@@ -1234,7 +1268,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1234 | return true; | 1268 | return true; |
1235 | } | 1269 | } |
1236 | /// <summary> | 1270 | /// <summary> |
1237 | /// | 1271 | /// Tell a single agent to disconnect from the region. |
1238 | /// </summary> | 1272 | /// </summary> |
1239 | /// <param name="regionHandle"></param> | 1273 | /// <param name="regionHandle"></param> |
1240 | /// <param name="agentID"></param> | 1274 | /// <param name="agentID"></param> |
@@ -1245,6 +1279,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1245 | ScenePresence presence = m_innerScene.GetScenePresence(agentID); | 1279 | ScenePresence presence = m_innerScene.GetScenePresence(agentID); |
1246 | if (presence != null) | 1280 | if (presence != null) |
1247 | { | 1281 | { |
1282 | // Tell a single agent to disconnect from the region. | ||
1248 | libsecondlife.Packets.DisableSimulatorPacket disable = new libsecondlife.Packets.DisableSimulatorPacket(); | 1283 | libsecondlife.Packets.DisableSimulatorPacket disable = new libsecondlife.Packets.DisableSimulatorPacket(); |
1249 | presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task); | 1284 | presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task); |
1250 | } | 1285 | } |
@@ -1252,6 +1287,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
1252 | } | 1287 | } |
1253 | 1288 | ||
1254 | /// <summary> | 1289 | /// <summary> |
1290 | /// Tell neighboring regions about this agent | ||
1291 | /// When the regions respond with a true value, | ||
1292 | /// tell the agents about the region. | ||
1293 | /// | ||
1294 | /// We have to tell the regions about the agents first otherwise it'll deny them access | ||
1255 | /// | 1295 | /// |
1256 | /// </summary> | 1296 | /// </summary> |
1257 | /// <param name="presence"></param> | 1297 | /// <param name="presence"></param> |
@@ -1261,7 +1301,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1261 | } | 1301 | } |
1262 | 1302 | ||
1263 | /// <summary> | 1303 | /// <summary> |
1264 | /// | 1304 | /// Tell a neighboring region about this agent |
1265 | /// </summary> | 1305 | /// </summary> |
1266 | /// <param name="presence"></param> | 1306 | /// <param name="presence"></param> |
1267 | /// <param name="region"></param> | 1307 | /// <param name="region"></param> |
@@ -1271,7 +1311,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1271 | } | 1311 | } |
1272 | 1312 | ||
1273 | /// <summary> | 1313 | /// <summary> |
1274 | /// | 1314 | /// Requests information about this region from gridcomms |
1275 | /// </summary> | 1315 | /// </summary> |
1276 | /// <param name="regionHandle"></param> | 1316 | /// <param name="regionHandle"></param> |
1277 | /// <returns></returns> | 1317 | /// <returns></returns> |
@@ -1281,7 +1321,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1281 | } | 1321 | } |
1282 | 1322 | ||
1283 | /// <summary> | 1323 | /// <summary> |
1284 | /// | 1324 | /// Requests textures for map from minimum region to maximum region in world cordinates |
1285 | /// </summary> | 1325 | /// </summary> |
1286 | /// <param name="remoteClient"></param> | 1326 | /// <param name="remoteClient"></param> |
1287 | /// <param name="minX"></param> | 1327 | /// <param name="minX"></param> |
@@ -1294,7 +1334,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1294 | } | 1334 | } |
1295 | 1335 | ||
1296 | /// <summary> | 1336 | /// <summary> |
1297 | /// | 1337 | /// Tries to teleport agent to other region. |
1298 | /// </summary> | 1338 | /// </summary> |
1299 | /// <param name="remoteClient"></param> | 1339 | /// <param name="remoteClient"></param> |
1300 | /// <param name="regionHandle"></param> | 1340 | /// <param name="regionHandle"></param> |
@@ -1311,7 +1351,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1311 | } | 1351 | } |
1312 | 1352 | ||
1313 | /// <summary> | 1353 | /// <summary> |
1314 | /// | 1354 | /// Agent is crossing the border into a neighbouring region. Tell the neighbour about it! |
1315 | /// </summary> | 1355 | /// </summary> |
1316 | /// <param name="regionHandle"></param> | 1356 | /// <param name="regionHandle"></param> |
1317 | /// <param name="agentID"></param> | 1357 | /// <param name="agentID"></param> |
@@ -1641,7 +1681,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1641 | #endregion | 1681 | #endregion |
1642 | 1682 | ||
1643 | /// <summary> | 1683 | /// <summary> |
1644 | /// | 1684 | /// Causes all clients to get a full object update on all of the objects in the scene. |
1645 | /// </summary> | 1685 | /// </summary> |
1646 | public void ForceClientUpdate() | 1686 | public void ForceClientUpdate() |
1647 | { | 1687 | { |
@@ -1655,7 +1695,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
1655 | } | 1695 | } |
1656 | 1696 | ||
1657 | /// <summary> | 1697 | /// <summary> |
1658 | /// | 1698 | /// This is currently only used for scale (to scale to MegaPrim size) |
1699 | /// There is a console command that calls this in OpenSimMain | ||
1659 | /// </summary> | 1700 | /// </summary> |
1660 | /// <param name="cmdparams"></param> | 1701 | /// <param name="cmdparams"></param> |
1661 | public void HandleEditCommand(string[] cmdparams) | 1702 | public void HandleEditCommand(string[] cmdparams) |
@@ -1682,7 +1723,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1682 | } | 1723 | } |
1683 | 1724 | ||
1684 | /// <summary> | 1725 | /// <summary> |
1685 | /// | 1726 | /// Shows various details about the sim based on the parameters supplied by the console command in openSimMain. |
1686 | /// </summary> | 1727 | /// </summary> |
1687 | /// <param name="showWhat"></param> | 1728 | /// <param name="showWhat"></param> |
1688 | public void Show(string showWhat) | 1729 | public void Show(string showWhat) |
@@ -1726,7 +1767,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1726 | #region Script Handling Methods | 1767 | #region Script Handling Methods |
1727 | 1768 | ||
1728 | /// <summary> | 1769 | /// <summary> |
1729 | /// | 1770 | /// Console command handler to send script command to script engine. |
1730 | /// </summary> | 1771 | /// </summary> |
1731 | /// <param name="args"></param> | 1772 | /// <param name="args"></param> |
1732 | public void SendCommandToPlugins(string[] args) | 1773 | public void SendCommandToPlugins(string[] args) |