diff options
author | Teravus Ovares | 2007-11-25 04:52:14 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-11-25 04:52:14 +0000 |
commit | d263a044b1ebb13477b2b391637ccc2da4368838 (patch) | |
tree | 6288ef8e8f2a1c073705b23db8aba8603a28c34d /OpenSim/Region/Environment/Scenes/Scene.cs | |
parent | Ignore nullreferenceexception in removeclient. The avatar is already gone. (diff) | |
download | opensim-SC-d263a044b1ebb13477b2b391637ccc2da4368838.zip opensim-SC-d263a044b1ebb13477b2b391637ccc2da4368838.tar.gz opensim-SC-d263a044b1ebb13477b2b391637ccc2da4368838.tar.bz2 opensim-SC-d263a044b1ebb13477b2b391637ccc2da4368838.tar.xz |
* Added the ability to restart your individual sims from within them using the estate tools.
* The sims properly restart, however they don't yet notify the existing avatars that they are up. To see the sim again, you'll need to log-out and back in until I can figure out how to get the proper data to the sims and to the avatar so they reconnect again.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 101 |
1 files changed, 97 insertions, 4 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 735dddb..9cdb49b 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -70,6 +70,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
70 | private readonly Mutex updateLock; | 70 | private readonly Mutex updateLock; |
71 | public bool m_physicalPrim; | 71 | public bool m_physicalPrim; |
72 | public bool m_sendTasksToChild; | 72 | public bool m_sendTasksToChild; |
73 | private int m_RestartTimerCounter; | ||
74 | private Timer t_restartTimer = new Timer(15000); // Wait before firing | ||
75 | private int m_incrementsof15seconds = 0; | ||
76 | |||
73 | protected ModuleLoader m_moduleLoader; | 77 | protected ModuleLoader m_moduleLoader; |
74 | protected StorageManager m_storageManager; | 78 | protected StorageManager m_storageManager; |
75 | protected AgentCircuitManager m_authenticateHandler; | 79 | protected AgentCircuitManager m_authenticateHandler; |
@@ -253,15 +257,80 @@ namespace OpenSim.Region.Environment.Scenes | |||
253 | m_eventManager.OnPermissionError += SendPermissionAlert; | 257 | m_eventManager.OnPermissionError += SendPermissionAlert; |
254 | } | 258 | } |
255 | 259 | ||
260 | public override void OtherRegionUp(RegionInfo otherRegion) | ||
261 | { | ||
262 | // Another region is up. We have to tell all our ScenePresences about it | ||
263 | // This fails to get the desired effect and needs further work. | ||
264 | |||
265 | ForEachScenePresence(delegate(ScenePresence agent) | ||
266 | { | ||
267 | if (!(agent.IsChildAgent)) | ||
268 | { | ||
269 | InformClientOfNeighbor(agent, otherRegion); | ||
270 | this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); | ||
271 | |||
272 | } | ||
273 | } | ||
274 | ); | ||
275 | } | ||
276 | public virtual void Restart(float seconds) | ||
277 | { | ||
278 | if (seconds < 100) | ||
279 | { | ||
280 | t_restartTimer.Stop(); | ||
281 | SendGeneralAlert("Restart Aborted"); | ||
282 | } | ||
283 | else | ||
284 | { | ||
285 | t_restartTimer.Interval = 15000; | ||
286 | m_incrementsof15seconds = (int) seconds/15; | ||
287 | m_RestartTimerCounter = 0; | ||
288 | t_restartTimer.AutoReset = true; | ||
289 | t_restartTimer.Elapsed += new ElapsedEventHandler(restartTimer_Elapsed); | ||
290 | MainLog.Instance.Error("REGION", "Restarting Region in " + (seconds / 60) + " minutes"); | ||
291 | t_restartTimer.Start(); | ||
292 | SendGeneralAlert("Restarting in 2 Minutes"); | ||
293 | } | ||
294 | |||
295 | |||
296 | } | ||
297 | public void restartTimer_Elapsed(object sender, ElapsedEventArgs e) | ||
298 | { | ||
299 | m_RestartTimerCounter++; | ||
300 | if (m_RestartTimerCounter <= m_incrementsof15seconds) | ||
301 | { | ||
302 | if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7) | ||
303 | SendGeneralAlert("Restarting in " + ((8-m_RestartTimerCounter) * 15) + " seconds"); | ||
304 | } | ||
305 | else | ||
306 | { | ||
307 | t_restartTimer.Stop(); | ||
308 | MainLog.Instance.Error("REGION", "Closing"); | ||
309 | Close(); | ||
310 | MainLog.Instance.Error("REGION", "Firing Region Restart Message"); | ||
311 | base.Restart(0); | ||
312 | } | ||
313 | |||
314 | } | ||
256 | public override void Close() | 315 | public override void Close() |
257 | { | 316 | { |
258 | ForEachScenePresence(delegate(ScenePresence avatar) | 317 | ForEachScenePresence(delegate(ScenePresence avatar) |
259 | { | 318 | { |
260 | avatar.ControllingClient.Kick("The region is going down."); | 319 | if (avatar.KnownChildRegions.Contains(RegionInfo.RegionHandle)) |
320 | avatar.KnownChildRegions.Remove(RegionInfo.RegionHandle); | ||
321 | |||
322 | if (!avatar.IsChildAgent) | ||
323 | avatar.ControllingClient.Kick("The simulator is going down."); | ||
324 | |||
325 | avatar.ControllingClient.OutPacket(new libsecondlife.Packets.DisableSimulatorPacket(), ThrottleOutPacketType.Task); | ||
261 | 326 | ||
262 | }); | 327 | }); |
328 | |||
329 | Thread.Sleep(500); | ||
330 | |||
263 | ForEachScenePresence(delegate(ScenePresence avatar) | 331 | ForEachScenePresence(delegate(ScenePresence avatar) |
264 | { | 332 | { |
333 | |||
265 | avatar.ControllingClient.Stop(); | 334 | avatar.ControllingClient.Stop(); |
266 | 335 | ||
267 | }); | 336 | }); |
@@ -269,7 +338,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
269 | 338 | ||
270 | m_heartbeatTimer.Close(); | 339 | m_heartbeatTimer.Close(); |
271 | m_innerScene.Close(); | 340 | m_innerScene.Close(); |
272 | m_sceneGridService.Close(); | 341 | UnRegisterReginWithComms(); |
273 | 342 | ||
274 | foreach (IRegionModule module in this.Modules.Values) | 343 | foreach (IRegionModule module in this.Modules.Values) |
275 | { | 344 | { |
@@ -992,6 +1061,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
992 | m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; | 1061 | m_sceneGridService.OnAvatarCrossingIntoRegion += AgentCrossing; |
993 | m_sceneGridService.OnCloseAgentConnection += CloseConnection; | 1062 | m_sceneGridService.OnCloseAgentConnection += CloseConnection; |
994 | } | 1063 | } |
1064 | public void UnRegisterReginWithComms() | ||
1065 | { | ||
1066 | m_sceneGridService.OnExpectUser -= NewUserConnection; | ||
1067 | m_sceneGridService.OnAvatarCrossingIntoRegion -= AgentCrossing; | ||
1068 | m_sceneGridService.OnCloseAgentConnection -= CloseConnection; | ||
1069 | |||
1070 | m_sceneGridService.Close(); | ||
1071 | } | ||
995 | 1072 | ||
996 | /// <summary> | 1073 | /// <summary> |
997 | /// | 1074 | /// |
@@ -1060,6 +1137,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1060 | { | 1137 | { |
1061 | m_sceneGridService.EnableNeighbourChildAgents(presence); | 1138 | m_sceneGridService.EnableNeighbourChildAgents(presence); |
1062 | } | 1139 | } |
1140 | public void InformClientOfNeighbor(ScenePresence presence, RegionInfo region) | ||
1141 | { | ||
1142 | m_sceneGridService.InformNeighborChildAgent(presence, region); | ||
1143 | } | ||
1063 | 1144 | ||
1064 | /// <summary> | 1145 | /// <summary> |
1065 | /// | 1146 | /// |
@@ -1258,9 +1339,15 @@ namespace OpenSim.Region.Environment.Scenes | |||
1258 | 1339 | ||
1259 | ClientManager.ForEachClient(delegate (IClientAPI controller) | 1340 | ClientManager.ForEachClient(delegate (IClientAPI controller) |
1260 | { | 1341 | { |
1261 | if (controller.AgentId != godid) // Do we really want to kick the initiator of this madness? | 1342 | ScenePresence p = GetScenePresence(controller.AgentId); |
1343 | bool childagent = false; | ||
1344 | if (!p.Equals(null)) | ||
1345 | if (p.IsChildAgent) | ||
1346 | childagent=true; | ||
1347 | if (controller.AgentId != godid && !childagent) // Do we really want to kick the initiator of this madness? | ||
1262 | { | 1348 | { |
1263 | controller.Kick(Helpers.FieldToUTF8String(reason)); | 1349 | controller.Kick(Helpers.FieldToUTF8String(reason)); |
1350 | |||
1264 | } | 1351 | } |
1265 | } | 1352 | } |
1266 | ); | 1353 | ); |
@@ -1269,7 +1356,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
1269 | // Is there another way to make sure *all* clients get this 'inter region' message? | 1356 | // Is there another way to make sure *all* clients get this 'inter region' message? |
1270 | ClientManager.ForEachClient(delegate (IClientAPI controller) | 1357 | ClientManager.ForEachClient(delegate (IClientAPI controller) |
1271 | { | 1358 | { |
1272 | if (controller.AgentId != godid) // Do we really want to kick the initiator of this madness? | 1359 | ScenePresence p = GetScenePresence(controller.AgentId); |
1360 | bool childagent = false; | ||
1361 | if (!p.Equals(null)) | ||
1362 | if (p.IsChildAgent) | ||
1363 | childagent = true; | ||
1364 | |||
1365 | if (controller.AgentId != godid && !childagent) // Do we really want to kick the initiator of this madness? | ||
1273 | { | 1366 | { |
1274 | controller.Close(); | 1367 | controller.Close(); |
1275 | } | 1368 | } |