public void Destroy() { lock (_ioLock) { Stop(true); StopGuardAndWait(new TimeSpan(0, 0, 0, 10)); foreach (var port in reservedPorts) { tcpPortManager.ReleaseLocalPort(port, user.UserName); } tcpPortManager.RemoveFirewallRules(user.UserName); // BR - Unmap the mounted directories (Removes user ACLs) try { jobObject.TerminateProcessesAndWait(); } catch (ObjectDisposedException) { } jobObject.Dispose(); if (directory != null) { directory.Destroy(); } deleteUserDiskQuota(); if (user != null) { user.Delete(); } this.currentState = ContainerState.Destroyed; } }
public void Destroy() { lock (_ioLock) { LogCompletionStatus(); Stop(true); StopGuardAndWait(new TimeSpan(0, 0, 0, 10)); foreach (var port in reservedPorts) { tcpPortManager.ReleaseLocalPort(port, user.UserName); } tcpPortManager.RemoveFirewallRules(user.UserName); try { jobObject.TerminateProcessesAndWait(); } catch (ObjectDisposedException) { } jobObject.Dispose(); directory.Destroy(); if (user != null) { directory.DeleteBindMounts(bindMounts, user); user.DeleteProfile(); user.Delete(); } deleteUserDiskQuota(); this.currentState = ContainerState.Destroyed; } }