/// <summary> /// This is the method that shuts down the scene. /// </summary> public void Close() { m_log.InfoFormat("[Scene]: Closing down the single simulator: {0}", RegionInfo.RegionName); // Kick all ROOT agents with the message, 'The simulator is going down' ForEachScenePresence(delegate(IScenePresence avatar) { if (!avatar.IsChildAgent) { avatar.ControllingClient.Kick("The simulator is going down."); } }); IEntityTransferModule transferModule = RequestModuleInterface <IEntityTransferModule> (); if (transferModule != null) { foreach (IScenePresence avatar in GetScenePresences()) { transferModule.IncomingCloseAgent(this, avatar.UUID); } } ShouldRunHeartbeat = false; //Stop the heartbeat //Now close the tracker monitor.Stop(); if (m_sceneGraph.PhysicsScene != null) { m_sceneGraph.PhysicsScene.Dispose(); } //Tell the neighbors that this region is now down INeighborService service = RequestModuleInterface <INeighborService>(); if (service != null) { service.InformNeighborsThatRegionIsDown(RegionInfo); } // Stop updating the scene objects and agents. shuttingdown = true; m_sceneGraph.Close(); }
private byte[] InformNeighborsRegionIsDown(Dictionary <string, object> request) { byte[] result = new byte[0]; // retrieve the region RegionInfo aRegion = new RegionInfo(); try { aRegion.UnpackRegionInfoData(Util.DictionaryToOSD(request)); } catch (Exception) { return(result); } if (m_AuthenticationService != null) { //Set password on the incoming region if (m_AuthenticationService.CheckExists(aRegion.RegionID)) { if (m_AuthenticationService.Authenticate(aRegion.RegionID, aRegion.Password.ToString(), 100) == "") { m_log.Warn("[RegionPostHandler]: Authentication failed for region " + aRegion.RegionName); return(result); } else { m_log.InfoFormat("[RegionPostHandler]: Authentication succeeded for {0}", aRegion.RegionName); } } else { m_log.Warn("[RegionPostHandler]: Authentication failed for region " + aRegion.RegionName); return(result); } } // Finally! List <GridRegion> thisRegion = m_NeighborService.InformNeighborsThatRegionIsDown(aRegion); Dictionary <string, object> resp = new Dictionary <string, object>(); if (thisRegion.Count != 0) { resp["success"] = "true"; int i = 0; foreach (GridRegion r in thisRegion) { Dictionary <string, object> region = r.ToKeyValuePairs(); resp["region" + i] = region; i++; } } else { resp["success"] = "false"; } string xmlString = WebUtils.BuildXmlResponse(resp); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); }