Refactor code.

This commit is contained in:
Christian
2021-10-21 19:23:58 +02:00
parent 212d88f167
commit 3835deb3d1
3 changed files with 16 additions and 5 deletions
@@ -38,7 +38,7 @@ namespace MQTTnet.Server.Internal
public MqttClientSessionApplicationMessagesQueue ApplicationMessagesQueue { get; }
public IDictionary<object, object> Items { get; }
public Task DeleteAsync()
{
return _clientSessionsManager.DeleteSessionAsync(ClientId);
@@ -290,7 +290,7 @@ namespace MQTTnet.Server.Internal
async Task TryProcessQueuedApplicationMessagesAsync(CancellationToken cancellationToken)
{
// Make sure all queued messages are proccessed befor server stops.
// Make sure all queued messages are processed before server stops.
while (!cancellationToken.IsCancellationRequested || _messageQueue.Any())
{
try
@@ -343,7 +343,7 @@ namespace MQTTnet.Server.Internal
}
}
if (interceptorContext.ApplicationMessage == null || !interceptorContext.AcceptPublish)
if (interceptorContext.ApplicationMessage == null || !interceptorContext.ProcessPublish)
{
return;
}
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
namespace MQTTnet.Server
{
@@ -17,7 +18,17 @@ namespace MQTTnet.Server
/// </summary>
public IDictionary<object, object> SessionItems { get; internal set; }
public bool AcceptPublish { get; set; } = true;
[Obsolete("Please use ProcessPublish instead.")]
public bool AcceptPublish
{
get => ProcessPublish;
set => ProcessPublish = value;
}
/// <summary>
/// Gets or sets whether the publish should be processed internally.
/// </summary>
public bool ProcessPublish { get; set; } = true;
public bool CloseConnection { get; set; }
}