diff --git a/Source/MQTTnet.Extensions.TopicTemplate/TopicTemplateExtensions.cs b/Source/MQTTnet.Extensions.TopicTemplate/TopicTemplateExtensions.cs index 59c6acdb..5d2374aa 100644 --- a/Source/MQTTnet.Extensions.TopicTemplate/TopicTemplateExtensions.cs +++ b/Source/MQTTnet.Extensions.TopicTemplate/TopicTemplateExtensions.cs @@ -32,20 +32,16 @@ namespace MQTTnet.Extensions.TopicTemplate { throw new ArgumentException("message does not have a response topic"); } - + return builder.WithTopic(message.ResponseTopic).WithCorrelationData(message.CorrelationData); } - + /// /// Set the filter topic according to the template, with /// remaining template parameters substituted by single-level /// wildcard. /// /// - /// a filter builder - /// - /// /// a topic template /// @@ -58,7 +54,7 @@ namespace MQTTnet.Extensions.TopicTemplate { return new MqttTopicFilterBuilder().WithTopicTemplate(topicTemplate, subscribeTreeRoot); } - + /// /// Return a message builder to respond to this message. The /// message's response topic and correlation data are included @@ -75,7 +71,7 @@ namespace MQTTnet.Extensions.TopicTemplate { return new MqttApplicationMessageBuilder().AsResponseTo(message); } - + /// /// Return whether the message matches the given topic template. /// @@ -96,7 +92,7 @@ namespace MQTTnet.Extensions.TopicTemplate { return topicTemplate.MatchesTopic(message.Topic, subtree); } - + /// /// Set the filter topic according to the template, with /// template parameters substituted by a single-level @@ -119,7 +115,7 @@ namespace MQTTnet.Extensions.TopicTemplate { return builder.WithTopic(subscribeTreeRoot ? topicTemplate.TopicTreeRootFilter : topicTemplate.TopicFilter); } - + /// /// Set the publication topic according to the topic template. The template /// must not have remaining (unset) parameters or contain wildcards. @@ -143,7 +139,7 @@ namespace MQTTnet.Extensions.TopicTemplate { throw new ArgumentException("topic templates must be parameter-less when sending " + topicTemplate.Template); } - + MqttTopicValidator.ThrowIfInvalid(topicTemplate.Template); return builder.WithTopic(topicTemplate.Template); } diff --git a/Source/MQTTnet.Tests/Clients/ManagedMqttClient/ManagedMqttClient_Tests.cs b/Source/MQTTnet.Tests/Clients/ManagedMqttClient/ManagedMqttClient_Tests.cs index ed459677..a32ea32f 100644 --- a/Source/MQTTnet.Tests/Clients/ManagedMqttClient/ManagedMqttClient_Tests.cs +++ b/Source/MQTTnet.Tests/Clients/ManagedMqttClient/ManagedMqttClient_Tests.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.VisualStudio.TestTools.UnitTesting; using MQTTnet.Client; using MQTTnet.Diagnostics; @@ -678,9 +677,9 @@ namespace MQTTnet.Tests.Clients.ManagedMqttClient { testEnvironment.IgnoreClientLogErrors = true; bool reject = true; - var receivedOnServer = new TaskCompletionSource(); + var receivedOnServer = new TaskCompletionSource(); managedClient.ApplicationMessageProcessedAsync += e => Task.FromResult(reject &= e.Exception is null); - testEnvironment.Server.InterceptingInboundPacketAsync += e => + testEnvironment.Server.InterceptingInboundPacketAsync += e => { if (e.Packet is MqttPublishPacket) { @@ -690,14 +689,14 @@ namespace MQTTnet.Tests.Clients.ManagedMqttClient } else { - receivedOnServer.TrySetResult(); + receivedOnServer.TrySetResult(null); } } return Task.CompletedTask; }; - await managedClient.EnqueueAsync(new MqttApplicationMessage { Topic = topic, Payload = new byte[] { 1 }, Retain = true, QualityOfServiceLevel = MqttQualityOfServiceLevel.AtLeastOnce }); + await managedClient.EnqueueAsync(new MqttApplicationMessage { Topic = topic, PayloadSegment = new ArraySegment(new byte[] { 1 }), Retain = true, QualityOfServiceLevel = MqttQualityOfServiceLevel.AtLeastOnce }); var timeoutTask = Task.Delay(testTimeout); diff --git a/Source/MQTTnet/Server/Internal/MqttServerKeepAliveMonitor.cs b/Source/MQTTnet/Server/Internal/MqttServerKeepAliveMonitor.cs index 441f007b..546f3e71 100644 --- a/Source/MQTTnet/Server/Internal/MqttServerKeepAliveMonitor.cs +++ b/Source/MQTTnet/Server/Internal/MqttServerKeepAliveMonitor.cs @@ -57,7 +57,7 @@ namespace MQTTnet.Server while (!cancellationToken.IsCancellationRequested) { TryProcessClients(); - Sleep(_options.KeepAliveMonitorInterval); + Sleep(_options.KeepAliveOptions.MonitorInterval); } } catch (OperationCanceledException)