mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-16 01:03:01 +08:00
Fix build errors and several warnings
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Set the filter topic according to the template, with
|
||||
/// remaining template parameters substituted by single-level
|
||||
/// wildcard.
|
||||
/// </summary>
|
||||
/// <param
|
||||
/// name="builder">
|
||||
/// a filter builder
|
||||
/// </param>
|
||||
/// <param
|
||||
/// name="topicTemplate">
|
||||
/// a topic template
|
||||
/// </param>
|
||||
@@ -58,7 +54,7 @@ namespace MQTTnet.Extensions.TopicTemplate
|
||||
{
|
||||
return new MqttTopicFilterBuilder().WithTopicTemplate(topicTemplate, subscribeTreeRoot);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Return whether the message matches the given topic template.
|
||||
/// </summary>
|
||||
@@ -96,7 +92,7 @@ namespace MQTTnet.Extensions.TopicTemplate
|
||||
{
|
||||
return topicTemplate.MatchesTopic(message.Topic, subtree);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 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);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 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);
|
||||
}
|
||||
|
||||
@@ -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<object>();
|
||||
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<byte>(new byte[] { 1 }), Retain = true, QualityOfServiceLevel = MqttQualityOfServiceLevel.AtLeastOnce });
|
||||
|
||||
var timeoutTask = Task.Delay(testTimeout);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace MQTTnet.Server
|
||||
while (!cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
TryProcessClients();
|
||||
Sleep(_options.KeepAliveMonitorInterval);
|
||||
Sleep(_options.KeepAliveOptions.MonitorInterval);
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
|
||||
Reference in New Issue
Block a user