From 60a75361418a850e155a9726a2ec9f4c949db383 Mon Sep 17 00:00:00 2001 From: 13xforever Date: Tue, 12 May 2020 20:52:22 +0500 Subject: [PATCH] use the new async methods for the pipe --- .../EventHandlers/LogParsing/ArchiveHandlers/GzipHandler.cs | 4 ++-- .../EventHandlers/LogParsing/ArchiveHandlers/PlainText.cs | 4 ++-- .../EventHandlers/LogParsing/ArchiveHandlers/RarHandler.cs | 4 ++-- .../LogParsing/ArchiveHandlers/SevenZipHandler.cs | 4 ++-- .../EventHandlers/LogParsing/ArchiveHandlers/ZipHandler.cs | 5 ++--- CompatBot/EventHandlers/LogParsing/LogParser.PipeReader.cs | 4 ++-- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/GzipHandler.cs b/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/GzipHandler.cs index d9399634..6e88ef94 100644 --- a/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/GzipHandler.cs +++ b/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/GzipHandler.cs @@ -54,10 +54,10 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers catch (Exception e) { Config.Log.Error(e, "Error filling the log pipe"); - writer.Complete(e); + await writer.CompleteAsync(e); return; } - writer.Complete(); + await writer.CompleteAsync(); } } } \ No newline at end of file diff --git a/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/PlainText.cs b/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/PlainText.cs index 11d60077..225d69d9 100644 --- a/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/PlainText.cs +++ b/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/PlainText.cs @@ -41,10 +41,10 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers catch (Exception e) { Config.Log.Error(e, "Error filling the log pipe"); - writer.Complete(e); + await writer.CompleteAsync(e); return; } - writer.Complete(); + await writer.CompleteAsync(); } } } diff --git a/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/RarHandler.cs b/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/RarHandler.cs index 0b232efa..97e7da06 100644 --- a/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/RarHandler.cs +++ b/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/RarHandler.cs @@ -57,7 +57,7 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers flushed = await writer.FlushAsync(cancellationToken).ConfigureAwait(false); SourcePosition = statsStream.Position; } while (read > 0 && !(flushed.IsCompleted || flushed.IsCanceled || cancellationToken.IsCancellationRequested)); - writer.Complete(); + await writer.CompleteAsync(); return; } SourcePosition = statsStream.Position; @@ -68,7 +68,7 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers { Config.Log.Error(e, "Error filling the log pipe"); } - writer.Complete(); + await writer.CompleteAsync(); } } } \ No newline at end of file diff --git a/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/SevenZipHandler.cs b/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/SevenZipHandler.cs index 12825bbc..f05d2f71 100644 --- a/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/SevenZipHandler.cs +++ b/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/SevenZipHandler.cs @@ -54,7 +54,7 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers writer.Advance(read); flushed = await writer.FlushAsync(cancellationToken).ConfigureAwait(false); } while (read > 0 && !(flushed.IsCompleted || flushed.IsCanceled || cancellationToken.IsCancellationRequested)); - writer.Complete(); + await writer.CompleteAsync(); return; } Config.Log.Warn("No 7z entries that match the log criteria"); @@ -63,7 +63,7 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers { Config.Log.Error(e, "Error filling the log pipe"); } - writer.Complete(); + await writer.CompleteAsync(); } } } \ No newline at end of file diff --git a/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/ZipHandler.cs b/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/ZipHandler.cs index e5517a4e..6359724a 100644 --- a/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/ZipHandler.cs +++ b/CompatBot/EventHandlers/LogParsing/ArchiveHandlers/ZipHandler.cs @@ -57,7 +57,7 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers flushed = await writer.FlushAsync(cancellationToken).ConfigureAwait(false); SourcePosition = statsStream.Position; } while (read > 0 && !(flushed.IsCompleted || flushed.IsCanceled || cancellationToken.IsCancellationRequested)); - writer.Complete(); + await writer.CompleteAsync(); return; } SourcePosition = statsStream.Position; @@ -68,8 +68,7 @@ namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers { Config.Log.Error(e, "Error filling the log pipe"); } - writer.Complete(); - + await writer.CompleteAsync(); } } } \ No newline at end of file diff --git a/CompatBot/EventHandlers/LogParsing/LogParser.PipeReader.cs b/CompatBot/EventHandlers/LogParsing/LogParser.PipeReader.cs index 9d11f510..be89a7db 100644 --- a/CompatBot/EventHandlers/LogParsing/LogParser.PipeReader.cs +++ b/CompatBot/EventHandlers/LogParsing/LogParser.PipeReader.cs @@ -55,7 +55,7 @@ namespace CompatBot.EventHandlers.LogParsing await OnNewLineAsync(buffer.Slice(0, lineEnd.Value), result.Buffer, currentSectionLines, state).ConfigureAwait(false); if (state.Error != LogParseState.ErrorCode.None) { - reader.Complete(); + await reader.CompleteAsync(); return state; } @@ -88,7 +88,7 @@ namespace CompatBot.EventHandlers.LogParsing } while (!(result.IsCompleted || result.IsCanceled || cancellationToken.IsCancellationRequested)); await TaskScheduler.WaitForClearTagAsync(state).ConfigureAwait(false); state.ReadBytes = totalReadBytes; - reader.Complete(); + await reader.CompleteAsync(); return state; }