From 6f6ff8554936c5e1583b6c932332a01b5a2525e1 Mon Sep 17 00:00:00 2001 From: ChsBuffer <33744752+chsbuffer@users.noreply.github.com> Date: Tue, 4 May 2021 10:23:53 +0800 Subject: [PATCH] Refactor Guard Thread safety --- Netch/Controllers/Guard.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Netch/Controllers/Guard.cs b/Netch/Controllers/Guard.cs index b9517441..349bc649 100644 --- a/Netch/Controllers/Guard.cs +++ b/Netch/Controllers/Guard.cs @@ -205,11 +205,11 @@ namespace Netch.Controllers if (!RedirectToFile) return; - if (_logFileStream == null) - return; - lock (LogStreamLock) { + if (_logFileStream == null) + return; + _flushFileStreamTimer.Enabled = false; _logStreamWriter?.Close(); _logFileStream?.Close();