diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-09-05 15:49:02 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-09-05 15:49:02 -0400 |
| commit | 49b799adbe3d65973b136bee758584748ecf6c2a (patch) | |
| tree | ce6784069ed4cb412c917dc1e3d884c56dea2654 /Emby.Server.Implementations/Logging/SimpleLogManager.cs | |
| parent | 3b318a3add352a72b6b0430300fddbf61edac216 (diff) | |
3.2.30.8
Diffstat (limited to 'Emby.Server.Implementations/Logging/SimpleLogManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Logging/SimpleLogManager.cs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/Logging/SimpleLogManager.cs b/Emby.Server.Implementations/Logging/SimpleLogManager.cs index 3a6992657..6129f38c4 100644 --- a/Emby.Server.Implementations/Logging/SimpleLogManager.cs +++ b/Emby.Server.Implementations/Logging/SimpleLogManager.cs @@ -107,6 +107,7 @@ namespace Emby.Server.Implementations.Logging } _fileLogger = null; + GC.SuppressFinalize(this); } } @@ -130,13 +131,18 @@ namespace Emby.Server.Implementations.Logging private void LogInternal() { - while (!_cancellationTokenSource.IsCancellationRequested) + while (!_cancellationTokenSource.IsCancellationRequested && !_disposed) { try { foreach (var message in _queue.GetConsumingEnumerable()) { var bytes = Encoding.UTF8.GetBytes(message + Environment.NewLine); + if (_disposed) + { + return; + } + _fileStream.Write(bytes, 0, bytes.Length); _fileStream.Flush(true); @@ -166,17 +172,18 @@ namespace Emby.Server.Implementations.Logging return; } - _fileStream.Flush(); + _fileStream.Flush(true); } public void Dispose() { _cancellationTokenSource.Cancel(); - _disposed = true; + Flush(); - _fileStream.Flush(); + _disposed = true; _fileStream.Dispose(); + GC.SuppressFinalize(this); } } |
