Skip to content

Commit

Permalink
Fix startup failure (#1421)
Browse files Browse the repository at this point in the history
  • Loading branch information
rnwood authored Apr 21, 2024
1 parent 8d60684 commit da3cb8d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions Rnwood.Smtp4dev/Server/ImapServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,15 @@ private void Logger_WriteLog(object sender, LumiSoft.Net.Log.WriteLogEventArgs e

Task IHostedService.StartAsync(CancellationToken cancellationToken)
{
return Task.Run(() => this.TryStart());
this.TryStart();
return Task.CompletedTask;

}

Task IHostedService.StopAsync(CancellationToken cancellationToken)
{
return Task.Run(() => this.Stop());
Task.Run(() => this.Stop());
return Task.CompletedTask;
}

class SessionHandler
Expand Down
6 changes: 4 additions & 2 deletions Rnwood.Smtp4dev/Server/Smtp4devServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,14 @@ public void TryStart()

Task IHostedService.StartAsync(CancellationToken cancellationToken)
{
return Task.Run(() => this.TryStart());
this.TryStart();
return Task.CompletedTask;
}

Task IHostedService.StopAsync(CancellationToken cancellationToken)
{
return Task.Run(() => this.Stop());
this.Stop();
return Task.CompletedTask;
}
}
}

0 comments on commit da3cb8d

Please sign in to comment.