Fixed: Android Deadlock from RPC Connection

This commit is contained in:
TheJoKlLa
2021-02-24 19:08:50 +01:00
parent bf091e4818
commit 65ea3ef6e9
42 changed files with 83 additions and 180 deletions

View File

@ -1,14 +1,12 @@
using Capnp;
using FabAccessAPI.Schema;
using FabAccessAPI.Schema;
using S22.Sasl;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Exception = System.Exception;
namespace FabAccessAPI {
namespace FabAccessAPI
{
/// Authentication Identity
///
/// Under the hood a string because the form depends heavily on the method

View File

@ -3,6 +3,7 @@ using FabAccessAPI.Schema;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace FabAccessAPI {
@ -37,18 +38,18 @@ namespace FabAccessAPI {
/// <param name="mech">The desired authentication mechanism</param>
/// <param name="kvs">Key-Value data specific to the mechanism</param>
/// <returns></returns>
public async Task Auth(string mech, Dictionary<string, object> kvs) {
public async Task Auth(string mech, Dictionary<string, object> kvs, CancellationToken cancellationToken_ = default) {
// _bootstrapCap = await _bootstrapCap.Unwrap();
var authCap = await _bootstrapCap.Auth();
var authCap = await _bootstrapCap.Auth(cancellationToken_);
_auth = new Auth(authCap);
var mechs = await _auth.GetMechanisms().ConfigureAwait(false);
var mechs = await _auth.GetMechanisms();
_Log.Debug($"The Server supports the following auth mechs: {string.Join(", ", mechs)}");
if (!mechs.Contains(mech)) {
throw new UnsupportedMechanismException();
}
await _auth.Authenticate(mech, kvs).ConfigureAwait(false);
await _auth.Authenticate(mech, kvs);
}
/// <summary>
@ -56,7 +57,7 @@ namespace FabAccessAPI {
/// </summary>
/// <returns>A wrapped capability to interact with machines</returns>
public async Task<Machines> AccessMachines() {
_machines ??= new Machines((await _bootstrapCap.Machines().ConfigureAwait(false)));
_machines ??= new Machines(await _bootstrapCap.Machines());
return _machines;
}
}

View File

@ -11,13 +11,14 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Capnp.Net.Runtime" Version="1.3.118" />
<PackageReference Include="CapnpC.CSharp.MsBuild.Generation" Version="1.3.118" />
<PackageReference Include="log4net" Version="2.0.12" />
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\capnproto-dotnetcore\Capnp.Net.Runtime\Capnp.Net.Runtime.csproj" />
<ProjectReference Include="..\external\CapnProto\Capnp.Net.Runtime\Capnp.Net.Runtime.csproj" />
<ProjectReference Include="..\external\SASL\S22.Sasl.csproj" />
</ItemGroup>

View File

@ -1,10 +1,10 @@
using FabAccessAPI.Schema;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace FabAccessAPI {
namespace FabAccessAPI
{
public class MachineException : Exception { }

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
//This is where the permissions subsystem will live
namespace FabAccessAPI {
//This is where the permissions subsystem will live
namespace FabAccessAPI
{
public class Permissions {
#region Log
private static readonly log4net.ILog _Log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);