private void KillAppDomain() { m_world.Shutdown(); m_host.Kill(TimeSpan.FromMinutes(1)); if (m_root != null) m_root.Kill(TimeSpan.FromMinutes(1)); if (m_appDomain != null) { try { AppDomain.Unload(m_appDomain); } catch (Exception e) { m_log.Warn("[" + Type + "]: Problem unloading application domain for " + Name + ". " + e.Message); } } m_world = null; m_host = null; m_root = null; m_appDomain = null; }
/// <summary> /// Start the script without specifying the user who caused the script to be started. Will not check authorization. /// </summary> internal bool Start() { //if (m_working) // return false; if (!IsInitialised) return false; //If the script is already running if (IsRunning) { ErrorString = ""; NotifyProblem("Unable to start " + Name + ", it is already Running."); return false; } //m_working = true; m_log.Debug("[" + Type + "]: Starting " + Name + "."); ErrorString = ""; m_world = new World(m_scene, m_creds, IsGod); m_host = new Host(m_world.Objects[m_hostSOP.LocalId], m_scene, new ExtensionHandler(m_extensions, this), m_microthreads); bool started = m_domainSetup != null ? StartInAppDomain() : StartLocal(); if (started) { m_start = DateTime.Now; m_log.Warn("[" + Type + "]: " + Name + " started."); m_running = true; } else NotifyProblem("Unable to start " + Name + "."); //m_working = false; return true; }