diff --git a/README.md b/README.md index 01c5c9d..fb53d3a 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Audio frames are transmitted in raw 16 bit integer format with 2 channels. Audio ## Development -Note: Currently OptimeGBA.io depends on a private branch of [OptimeGBA](https://github.com/Powerlated/OptimeGBA) which vends a library rather than an executable. +Note: Currently OptimeGBA.io depends on a [forked branch of OptimeGBA](https://github.com/Martin1994/OptimeGBA/tree/corelib) which vends a library rather than an executable. Run webpack dev server: diff --git a/server/Services/DaemonService.cs b/server/Services/DaemonService.cs index e065785..332ffd7 100644 --- a/server/Services/DaemonService.cs +++ b/server/Services/DaemonService.cs @@ -24,24 +24,25 @@ public async Task StartAsync(CancellationToken cancellationToken) { _logger.LogInformation("Starting up daemon..."); - _backgroundCancellation = new CancellationTokenSource(); - _backgroundTask = Task.Run(async () => - { - try - { - await RunAsync(_backgroundCancellation.Token); - } - catch (OperationCanceledException) {} - catch (Exception ex) - { - _logger.LogError(ex, ex.Message); - _lifetime.StopApplication(); - } - }); + _backgroundTask = RunAsyncAndWrapExceptions(); await Task.CompletedTask; } + private async Task RunAsyncAndWrapExceptions() { + _backgroundCancellation = new CancellationTokenSource(); + try + { + await RunAsync(_backgroundCancellation.Token); + } + catch (OperationCanceledException) {} + catch (Exception ex) + { + _logger.LogError(ex, ex.Message); + _lifetime.StopApplication(); + } + } + protected abstract Task RunAsync(CancellationToken cancellationToken); public async Task StopAsync(CancellationToken cancellationToken)