mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-16 01:03:01 +08:00
Refactor code.
This commit is contained in:
@@ -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; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user