Преглед изворни кода

Merge pull request #286 from JTrotta/master

ManagedClientStorage now works
release/3.x.x
Christian пре 6 година
committed by GitHub
родитељ
комит
97d0286a31
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 измењених фајлова са 7 додато и 4 уклоњено
  1. +4
    -0
      Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClient.cs
  2. +3
    -4
      Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClientStorageManager.cs

+ 4
- 0
Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClient.cs Прегледај датотеку

@@ -69,6 +69,10 @@ namespace MQTTnet.ManagedClient
{
_storageManager = new ManagedMqttClientStorageManager(_options.Storage);
await _storageManager.LoadQueuedMessagesAsync().ConfigureAwait(false);
foreach (var loadedMessage in _storageManager.ApplicationMessages)
{
_messageQueue.Add(loadedMessage);
}
}

_connectionCancellationToken = new CancellationTokenSource();


+ 3
- 4
Frameworks/MQTTnet.NetStandard/ManagedClient/ManagedMqttClientStorageManager.cs Прегледај датотеку

@@ -11,6 +11,8 @@ namespace MQTTnet.ManagedClient
private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1);
private readonly IManagedMqttClientStorage _storage;

public List<MqttApplicationMessage> ApplicationMessages => _applicationMessages;

public ManagedMqttClientStorageManager(IManagedMqttClientStorage storage)
{
_storage = storage ?? throw new ArgumentNullException(nameof(storage));
@@ -19,10 +21,7 @@ namespace MQTTnet.ManagedClient
public async Task LoadQueuedMessagesAsync()
{
var loadedMessages = await _storage.LoadQueuedMessagesAsync().ConfigureAwait(false);
foreach (var loadedMessage in loadedMessages)
{
_applicationMessages.Add(loadedMessage);
}
_applicationMessages.AddRange(loadedMessages);
}

public async Task AddAsync(MqttApplicationMessage applicationMessage)


Loading…
Откажи
Сачувај