|
@@ -48,10 +48,8 @@ namespace Ys.Scada.Manager
|
|
|
List<Tag> Tags { get; }
|
|
List<Tag> Tags { get; }
|
|
|
|
|
|
|
|
private readonly ConcurrentDictionary<string, ClientManager> _clients;
|
|
private readonly ConcurrentDictionary<string, ClientManager> _clients;
|
|
|
- private readonly ConcurrentDictionary<string, CancellationTokenSource> _ctsTokens;
|
|
|
|
|
public DataSourceManager(MemoryChannel<TransportMessage> memoryChannel, IFreeSql freeSql)
|
|
public DataSourceManager(MemoryChannel<TransportMessage> memoryChannel, IFreeSql freeSql)
|
|
|
{
|
|
{
|
|
|
- _ctsTokens = new ConcurrentDictionary<string, CancellationTokenSource>();
|
|
|
|
|
_clients = new ConcurrentDictionary<string, ClientManager>();
|
|
_clients = new ConcurrentDictionary<string, ClientManager>();
|
|
|
_memoryChannel = memoryChannel;
|
|
_memoryChannel = memoryChannel;
|
|
|
_scheduler = new DedicatedThreadTaskScheduler(100);
|
|
_scheduler = new DedicatedThreadTaskScheduler(100);
|
|
@@ -71,12 +69,10 @@ namespace Ys.Scada.Manager
|
|
|
}
|
|
}
|
|
|
public void Dispose()
|
|
public void Dispose()
|
|
|
{
|
|
{
|
|
|
|
|
+ foreach (var client in _clients.Values)
|
|
|
|
|
+ client.CTS.Cancel();
|
|
|
_clients.Clear();
|
|
_clients.Clear();
|
|
|
}
|
|
}
|
|
|
- public Task InvokeMessage(string message)
|
|
|
|
|
- {
|
|
|
|
|
- return Task.CompletedTask;
|
|
|
|
|
- }
|
|
|
|
|
public Task Cancel(string key)
|
|
public Task Cancel(string key)
|
|
|
{
|
|
{
|
|
|
if (_clients.TryGetValue(key, out ClientManager client))
|
|
if (_clients.TryGetValue(key, out ClientManager client))
|