Fixed an issue where reconnecting doesn't await the handle in the second attempt.
This commit is contained in:
@@ -109,12 +109,12 @@ namespace Wino.Core.UWP.Services
|
||||
{
|
||||
try
|
||||
{
|
||||
ConnectingHandle ??= new TaskCompletionSource<bool>();
|
||||
|
||||
var connectionCancellationToken = new CancellationTokenSource(TimeSpan.FromMilliseconds(ServerConnectionTimeoutMs));
|
||||
ConnectingHandle = new TaskCompletionSource<bool>();
|
||||
|
||||
Status = WinoServerConnectionStatus.Connecting;
|
||||
|
||||
var connectionCancellationToken = new CancellationTokenSource(TimeSpan.FromMilliseconds(ServerConnectionTimeoutMs));
|
||||
|
||||
await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
|
||||
|
||||
// Connection establishment handler is in App.xaml.cs OnBackgroundActivated.
|
||||
@@ -125,6 +125,14 @@ namespace Wino.Core.UWP.Services
|
||||
|
||||
Log.Information("Server connection established successfully.");
|
||||
}
|
||||
catch (OperationCanceledException canceledException)
|
||||
{
|
||||
Log.Error(canceledException, $"Server process did not start in {ServerConnectionTimeoutMs} ms. Operation is canceled.");
|
||||
|
||||
ConnectingHandle?.TrySetException(canceledException);
|
||||
|
||||
return false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Failed to connect to the server.");
|
||||
|
||||
Reference in New Issue
Block a user