Skip to content

Commit

Permalink
fix (ImapServer): Check if task is complete before attempting setResu…
Browse files Browse the repository at this point in the history
…lt. Fixes #872 (#876)
  • Loading branch information
jafin committed Sep 26, 2021
1 parent 228554e commit e3e290d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Rnwood.Smtp4dev/Server/ImapServer.cs
Expand Up @@ -75,7 +75,13 @@ public void TryStart()


var errorTcs = new TaskCompletionSource<Error_EventArgs>();
imapServer.Error += (s, ea) => errorTcs.SetResult(ea);
imapServer.Error += (s, ea) =>
{
if (!errorTcs.Task.IsCompleted)
{
errorTcs.SetResult(ea);
}
};
var startedTcs = new TaskCompletionSource<EventArgs>();
imapServer.Started += (s, ea) => startedTcs.SetResult(ea);

Expand Down

0 comments on commit e3e290d

Please sign in to comment.