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
|
try
|
||||||
{
|
{
|
||||||
ConnectingHandle ??= new TaskCompletionSource<bool>();
|
ConnectingHandle = new TaskCompletionSource<bool>();
|
||||||
|
|
||||||
var connectionCancellationToken = new CancellationTokenSource(TimeSpan.FromMilliseconds(ServerConnectionTimeoutMs));
|
|
||||||
|
|
||||||
Status = WinoServerConnectionStatus.Connecting;
|
Status = WinoServerConnectionStatus.Connecting;
|
||||||
|
|
||||||
|
var connectionCancellationToken = new CancellationTokenSource(TimeSpan.FromMilliseconds(ServerConnectionTimeoutMs));
|
||||||
|
|
||||||
await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
|
await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
|
||||||
|
|
||||||
// Connection establishment handler is in App.xaml.cs OnBackgroundActivated.
|
// Connection establishment handler is in App.xaml.cs OnBackgroundActivated.
|
||||||
@@ -125,6 +125,14 @@ namespace Wino.Core.UWP.Services
|
|||||||
|
|
||||||
Log.Information("Server connection established successfully.");
|
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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.Error(ex, "Failed to connect to the server.");
|
Log.Error(ex, "Failed to connect to the server.");
|
||||||
|
|||||||
Reference in New Issue
Block a user