Multiclient bug fixed
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Example.Shared;
|
||||
@@ -21,7 +22,7 @@ namespace Example.Backend
|
||||
|
||||
public void C()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
public void A()
|
||||
|
||||
@@ -131,7 +131,7 @@ class Program
|
||||
DemoCheck.TaskCancelation = true;
|
||||
#endif
|
||||
|
||||
const int iterations = 10000;
|
||||
const int iterations = 10_000;
|
||||
var timer = Stopwatch.StartNew();
|
||||
var x = 0;
|
||||
for (int i = 0; i < iterations; i++)
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace Example.Shared
|
||||
int Last(int next);
|
||||
void C();
|
||||
void A();
|
||||
|
||||
Task AsyncTest(CancellationToken token = default);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace mROA.Cbor
|
||||
{
|
||||
public class CborSerializationToolkit : IContextualSerializationToolKit
|
||||
{
|
||||
private static Dictionary<Type, List<PropertyInfo>> _propertiesCache = new();
|
||||
private Dictionary<Type, List<PropertyInfo>> _propertiesCache = new();
|
||||
public static TimeSpan SerializationTime = TimeSpan.Zero;
|
||||
public byte[] Serialize(object objectToSerialize, IEndPointContext context)
|
||||
{
|
||||
@@ -232,7 +232,7 @@ namespace mROA.Cbor
|
||||
return;
|
||||
}
|
||||
|
||||
var properties = GetAvalibleProperties(type);
|
||||
var properties = GetAvailableProperties(type);
|
||||
var values = properties.Select(property => property.GetValue(obj)).ToList();
|
||||
WriteList(values, writer, context);
|
||||
}
|
||||
@@ -403,7 +403,7 @@ namespace mROA.Cbor
|
||||
|
||||
private void FillObject(object obj, Type type, CborReader reader, IEndPointContext? context)
|
||||
{
|
||||
var properties = GetAvalibleProperties(type);
|
||||
var properties = GetAvailableProperties(type);
|
||||
var length = reader.ReadStartArray();
|
||||
try
|
||||
{
|
||||
@@ -441,7 +441,7 @@ namespace mROA.Cbor
|
||||
return finalProperties;
|
||||
}
|
||||
|
||||
private List<PropertyInfo> GetAvalibleProperties(Type type)
|
||||
private List<PropertyInfo> GetAvailableProperties(Type type)
|
||||
{
|
||||
if (_propertiesCache.TryGetValue(type, out var properties))
|
||||
{
|
||||
|
||||
@@ -25,6 +25,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TotalDemo", "TotalDemo", "{
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mROA.CodegenTools", "mROA.CodegenTools\mROA.CodegenTools.csproj", "{FFB8DFAE-17F0-4335-8F17-187B3619E8F2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.Load", "Example.Load\Example.Load.csproj", "{930B236B-BDAA-4B8C-8054-5B992BAE6622}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -67,6 +69,10 @@ Global
|
||||
{FFB8DFAE-17F0-4335-8F17-187B3619E8F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FFB8DFAE-17F0-4335-8F17-187B3619E8F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FFB8DFAE-17F0-4335-8F17-187B3619E8F2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{930B236B-BDAA-4B8C-8054-5B992BAE6622}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{930B236B-BDAA-4B8C-8054-5B992BAE6622}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{930B236B-BDAA-4B8C-8054-5B992BAE6622}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{930B236B-BDAA-4B8C-8054-5B992BAE6622}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -76,5 +82,6 @@ Global
|
||||
{A9BB364E-0BA6-40B9-A293-757BC48EFC06} = {FC4FA752-10A7-4D78-A7C2-9BCD8A81FB5E}
|
||||
{9BD25A13-3165-47C0-9EAA-5C59EC490E32} = {FC4FA752-10A7-4D78-A7C2-9BCD8A81FB5E}
|
||||
{E7703F5B-F2A6-4A88-AA57-EBB1E38D533E} = {FC4FA752-10A7-4D78-A7C2-9BCD8A81FB5E}
|
||||
{930B236B-BDAA-4B8C-8054-5B992BAE6622} = {FC4FA752-10A7-4D78-A7C2-9BCD8A81FB5E}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using mROA.Abstract;
|
||||
@@ -7,7 +8,7 @@ namespace mROA.Implementation
|
||||
{
|
||||
public class CancellationRepository : ICancellationRepository
|
||||
{
|
||||
private Dictionary<Guid, CancellationTokenSource> _cancellations = new();
|
||||
private ConcurrentDictionary<Guid, CancellationTokenSource> _cancellations = new();
|
||||
|
||||
public void RegisterCancellation(Guid id, CancellationTokenSource cts)
|
||||
{
|
||||
@@ -16,12 +17,12 @@ namespace mROA.Implementation
|
||||
|
||||
public CancellationTokenSource? GetCancellation(Guid id)
|
||||
{
|
||||
return _cancellations.GetValueOrDefault(id, null);
|
||||
return _cancellations.GetValueOrDefault(id);
|
||||
}
|
||||
|
||||
public void FreeCancelation(Guid id)
|
||||
{
|
||||
_cancellations.Remove(id);
|
||||
_cancellations.Remove(id, out _);
|
||||
}
|
||||
|
||||
public void Inject<T>(T dependency)
|
||||
|
||||
Reference in New Issue
Block a user