Преглед на файлове

Fix build warnings and errors.

release/3.x.x
Christian Kratky преди 4 години
родител
ревизия
54870adc64
променени са 15 файла, в които са добавени 91 реда и са изтрити 58 реда
  1. +4
    -0
      Build/MQTTnet.AspNetCore.nuspec
  2. +4
    -0
      Build/MQTTnet.Extensions.ManagedClient.nuspec
  3. +4
    -0
      Build/MQTTnet.Extensions.Rpc.nuspec
  4. +4
    -0
      Build/MQTTnet.Extensions.WebSocket4Net.nuspec
  5. +4
    -0
      Build/MQTTnet.NETStandard.nuspec
  6. +4
    -0
      Build/MQTTnet.nuspec
  7. +8
    -8
      Build/build.ps1
  8. +2
    -2
      Documents/Import_CodeSigningKey.md
  9. +5
    -5
      Source/MQTTnet.AspnetCore/Client/Tcp/TcpConnection.cs
  10. +17
    -17
      Source/MQTTnet.Server/Mqtt/MqttServerService.cs
  11. +15
    -7
      Source/MQTTnet.Server/Program.cs
  12. +12
    -17
      Source/MQTTnet.Server/Web/Startup.cs
  13. +2
    -0
      Source/MQTTnet/Diagnostics/MqttNetLogMessagePublishedEventArgs.cs
  14. +1
    -1
      Tests/MQTTnet.Core.Tests/CrossPlatformSocket_Tests.cs
  15. +5
    -1
      Tests/MQTTnet.Core.Tests/Mockups/TestLogger.cs

+ 4
- 0
Build/MQTTnet.AspNetCore.nuspec Целия файл

@@ -8,6 +8,7 @@
<license type="file">LICENSE</license> <license type="file">LICENSE</license>
<projectUrl>https://github.com/chkr1011/MQTTnet</projectUrl> <projectUrl>https://github.com/chkr1011/MQTTnet</projectUrl>
<iconUrl>https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png</iconUrl> <iconUrl>https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png</iconUrl>
<icon>images\Logo_128x128.png</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance> <requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>This is a support library to integrate MQTTnet into AspNetCore.</description> <description>This is a support library to integrate MQTTnet into AspNetCore.</description>
<releaseNotes>For release notes please go to MQTTnet release notes (https://www.nuget.org/packages/MQTTnet/).</releaseNotes> <releaseNotes>For release notes please go to MQTTnet release notes (https://www.nuget.org/packages/MQTTnet/).</releaseNotes>
@@ -27,6 +28,9 @@
<!-- License --> <!-- License -->
<file src="..\LICENSE" /> <file src="..\LICENSE" />


<!-- Images -->
<file src="..\Images\Logo_128x128.png" target="images\" />

<!-- .NET Standard 2.0 --> <!-- .NET Standard 2.0 -->
<file src="..\Source\MQTTnet.AspNetCore\bin\Release\netstandard2.0\MQTTnet.AspNetCore.*" target="lib\netstandard2.0\"/> <file src="..\Source\MQTTnet.AspNetCore\bin\Release\netstandard2.0\MQTTnet.AspNetCore.*" target="lib\netstandard2.0\"/>
</files> </files>


+ 4
- 0
Build/MQTTnet.Extensions.ManagedClient.nuspec Целия файл

@@ -8,6 +8,7 @@
<license type="file">LICENSE</license> <license type="file">LICENSE</license>
<projectUrl>https://github.com/chkr1011/MQTTnet</projectUrl> <projectUrl>https://github.com/chkr1011/MQTTnet</projectUrl>
<iconUrl>https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png</iconUrl> <iconUrl>https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png</iconUrl>
<icon>images\Logo_128x128.png</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance> <requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>This is an extension library which provides a managed MQTT client with additional features using MQTTnet.</description> <description>This is an extension library which provides a managed MQTT client with additional features using MQTTnet.</description>
<releaseNotes>For release notes please go to MQTTnet release notes (https://www.nuget.org/packages/MQTTnet/).</releaseNotes> <releaseNotes>For release notes please go to MQTTnet release notes (https://www.nuget.org/packages/MQTTnet/).</releaseNotes>
@@ -22,6 +23,9 @@
<!-- License --> <!-- License -->
<file src="..\LICENSE" /> <file src="..\LICENSE" />


<!-- Images -->
<file src="..\Images\Logo_128x128.png" target="images\" />

<!-- .NET Standard 1.3 --> <!-- .NET Standard 1.3 -->
<file src="..\Source\MQTTnet.Extensions.ManagedClient\bin\Release\netstandard1.3\MQTTnet.Extensions.ManagedClient.*" target="lib\netstandard1.3\"/> <file src="..\Source\MQTTnet.Extensions.ManagedClient\bin\Release\netstandard1.3\MQTTnet.Extensions.ManagedClient.*" target="lib\netstandard1.3\"/>




+ 4
- 0
Build/MQTTnet.Extensions.Rpc.nuspec Целия файл

@@ -8,6 +8,7 @@
<license type="file">LICENSE</license> <license type="file">LICENSE</license>
<projectUrl>https://github.com/chkr1011/MQTTnet</projectUrl> <projectUrl>https://github.com/chkr1011/MQTTnet</projectUrl>
<iconUrl>https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png</iconUrl> <iconUrl>https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png</iconUrl>
<icon>images\Logo_128x128.png</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance> <requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>This is an extension library which allows executing synchronous device calls including a response using MQTTnet.</description> <description>This is an extension library which allows executing synchronous device calls including a response using MQTTnet.</description>
<releaseNotes>For release notes please go to MQTTnet release notes (https://www.nuget.org/packages/MQTTnet/).</releaseNotes> <releaseNotes>For release notes please go to MQTTnet release notes (https://www.nuget.org/packages/MQTTnet/).</releaseNotes>
@@ -22,6 +23,9 @@
<!-- License --> <!-- License -->
<file src="..\LICENSE" /> <file src="..\LICENSE" />


<!-- Images -->
<file src="..\Images\Logo_128x128.png" target="images\" />

<!-- .NET Standard 1.3 --> <!-- .NET Standard 1.3 -->
<file src="..\Source\MQTTnet.Extensions.Rpc\bin\Release\netstandard1.3\MQTTnet.Extensions.Rpc.*" target="lib\netstandard1.3\"/> <file src="..\Source\MQTTnet.Extensions.Rpc\bin\Release\netstandard1.3\MQTTnet.Extensions.Rpc.*" target="lib\netstandard1.3\"/>




+ 4
- 0
Build/MQTTnet.Extensions.WebSocket4Net.nuspec Целия файл

@@ -8,6 +8,7 @@
<license type="file">LICENSE</license> <license type="file">LICENSE</license>
<projectUrl>https://github.com/chkr1011/MQTTnet</projectUrl> <projectUrl>https://github.com/chkr1011/MQTTnet</projectUrl>
<iconUrl>https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png</iconUrl> <iconUrl>https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png</iconUrl>
<icon>images\Logo_128x128.png</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance> <requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>This is an extension library which allows using _WebSocket4Net_ as transport for MQTTnet clients.</description> <description>This is an extension library which allows using _WebSocket4Net_ as transport for MQTTnet clients.</description>
<releaseNotes>For release notes please go to MQTTnet release notes (https://www.nuget.org/packages/MQTTnet/).</releaseNotes> <releaseNotes>For release notes please go to MQTTnet release notes (https://www.nuget.org/packages/MQTTnet/).</releaseNotes>
@@ -22,6 +23,9 @@
<!-- License --> <!-- License -->
<file src="..\LICENSE" /> <file src="..\LICENSE" />


<!-- Images -->
<file src="..\Images\Logo_128x128.png" target="images\" />

<!-- .NET Standard 1.3 --> <!-- .NET Standard 1.3 -->
<file src="..\Source\MQTTnet.Extensions.WebSocket4Net\bin\Release\netstandard1.3\MQTTnet.Extensions.WebSocket4Net.*" target="lib\netstandard1.3\"/> <file src="..\Source\MQTTnet.Extensions.WebSocket4Net\bin\Release\netstandard1.3\MQTTnet.Extensions.WebSocket4Net.*" target="lib\netstandard1.3\"/>




+ 4
- 0
Build/MQTTnet.NETStandard.nuspec Целия файл

@@ -8,6 +8,7 @@
<license type="file">LICENSE</license> <license type="file">LICENSE</license>
<projectUrl>https://github.com/chkr1011/MQTTnet</projectUrl> <projectUrl>https://github.com/chkr1011/MQTTnet</projectUrl>
<iconUrl>https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png</iconUrl> <iconUrl>https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png</iconUrl>
<icon>images\Logo_128x128.png</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance> <requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>This package contains the .NET Standard version of MQTTnet only.</description> <description>This package contains the .NET Standard version of MQTTnet only.</description>
<releaseNotes>For release notes please go to MQTTnet release notes (https://www.nuget.org/packages/MQTTnet/).</releaseNotes> <releaseNotes>For release notes please go to MQTTnet release notes (https://www.nuget.org/packages/MQTTnet/).</releaseNotes>
@@ -33,6 +34,9 @@
<!-- License --> <!-- License -->
<file src="..\LICENSE" /> <file src="..\LICENSE" />


<!-- Images -->
<file src="..\Images\Logo_128x128.png" target="images\" />

<!-- .NET Standard 1.3 --> <!-- .NET Standard 1.3 -->
<file src="..\Source\MQTTnet\bin\Release\netstandard1.3\MQTTnet.*" target="lib\netstandard1.3\"/> <file src="..\Source\MQTTnet\bin\Release\netstandard1.3\MQTTnet.*" target="lib\netstandard1.3\"/>




+ 4
- 0
Build/MQTTnet.nuspec Целия файл

@@ -8,6 +8,7 @@
<license type="file">LICENSE</license> <license type="file">LICENSE</license>
<projectUrl>https://github.com/chkr1011/MQTTnet</projectUrl> <projectUrl>https://github.com/chkr1011/MQTTnet</projectUrl>
<iconUrl>https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png</iconUrl> <iconUrl>https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png</iconUrl>
<icon>images\Logo_128x128.png</icon>
<requireLicenseAcceptance>false</requireLicenseAcceptance> <requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker) and supports v3.1.0, v3.1.1 and v5.0.0 of the MQTT protocol.</description> <description>MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker) and supports v3.1.0, v3.1.1 and v5.0.0 of the MQTT protocol.</description>
<releaseNotes> <releaseNotes>
@@ -55,6 +56,9 @@
<!-- License --> <!-- License -->
<file src="..\LICENSE" /> <file src="..\LICENSE" />


<!-- Images -->
<file src="..\Images\Logo_128x128.png" target="images\" />

<!-- .NET Standard 1.3 --> <!-- .NET Standard 1.3 -->
<file src="..\Source\MQTTnet\bin\Release\netstandard1.3\MQTTnet.*" target="lib\netstandard1.3\"/> <file src="..\Source\MQTTnet\bin\Release\netstandard1.3\MQTTnet.*" target="lib\netstandard1.3\"/>


+ 8
- 8
Build/build.ps1 Целия файл

@@ -84,8 +84,8 @@ Remove-Item "nuget.exe" -Force -Recurse -ErrorAction SilentlyContinue
# Build MQTTnet.Server Portable # Build MQTTnet.Server Portable
&dotnet publish ..\Source\MQTTnet.Server\MQTTnet.Server.csproj --configuration Release /p:FileVersion=$assemblyVersion /p:Version=$nugetVersion &dotnet publish ..\Source\MQTTnet.Server\MQTTnet.Server.csproj --configuration Release /p:FileVersion=$assemblyVersion /p:Version=$nugetVersion


$source = "..\Source\MQTTnet.Server\bin\Release\netcoreapp3.1\publish"
$destination = "..\Source\MQTTnet.Server\bin\MQTTnet.Server-Portable-v$nugetVersion.zip"
$source = (Convert-Path .) + "\..\Source\MQTTnet.Server\bin\Release\netcoreapp3.1\publish"
$destination = (Convert-Path .) + "\..\Source\MQTTnet.Server\bin\MQTTnet.Server-Portable-v$nugetVersion.zip"
If(Test-path $destination) {Remove-item $destination} If(Test-path $destination) {Remove-item $destination}
Add-Type -assembly "system.io.compression.filesystem" Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::CreateFromDirectory($source, $destination) [io.compression.zipfile]::CreateFromDirectory($source, $destination)
@@ -95,8 +95,8 @@ If(Test-path $destination) {Remove-item $destination}
# Build MQTTnet.Server Linux-x64 # Build MQTTnet.Server Linux-x64
&dotnet publish ..\Source\MQTTnet.Server\MQTTnet.Server.csproj --configuration Release /p:FileVersion=$assemblyVersion /p:Version=$nugetVersion --self-contained --runtime linux-x64 &dotnet publish ..\Source\MQTTnet.Server\MQTTnet.Server.csproj --configuration Release /p:FileVersion=$assemblyVersion /p:Version=$nugetVersion --self-contained --runtime linux-x64


$source = "..\Source\MQTTnet.Server\bin\Release\netcoreapp3.1\linux-x64\publish"
$destination = "..\Source\MQTTnet.Server\bin\MQTTnet.Server-Linux-x64-v$nugetVersion.zip"
$source = (Convert-Path .) + "\..\Source\MQTTnet.Server\bin\Release\netcoreapp3.1\linux-x64\publish"
$destination = (Convert-Path .) + "\..\Source\MQTTnet.Server\bin\MQTTnet.Server-Linux-x64-v$nugetVersion.zip"
If(Test-path $destination) {Remove-item $destination} If(Test-path $destination) {Remove-item $destination}
Add-Type -assembly "system.io.compression.filesystem" Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::CreateFromDirectory($source, $destination) [io.compression.zipfile]::CreateFromDirectory($source, $destination)
@@ -106,8 +106,8 @@ If(Test-path $destination) {Remove-item $destination}
# Build MQTTnet.Server Linux-ARM # Build MQTTnet.Server Linux-ARM
&dotnet publish ..\Source\MQTTnet.Server\MQTTnet.Server.csproj --configuration Release /p:FileVersion=$assemblyVersion /p:Version=$nugetVersion --self-contained --runtime linux-arm &dotnet publish ..\Source\MQTTnet.Server\MQTTnet.Server.csproj --configuration Release /p:FileVersion=$assemblyVersion /p:Version=$nugetVersion --self-contained --runtime linux-arm


$source = "..\Source\MQTTnet.Server\bin\Release\netcoreapp3.1\linux-ARM\publish"
$destination = "..\Source\MQTTnet.Server\bin\MQTTnet.Server-Linux-ARM-v$nugetVersion.zip"
$source = (Convert-Path .) + "\..\Source\MQTTnet.Server\bin\Release\netcoreapp3.1\linux-ARM\publish"
$destination = (Convert-Path .) + "\..\Source\MQTTnet.Server\bin\MQTTnet.Server-Linux-ARM-v$nugetVersion.zip"
If(Test-path $destination) {Remove-item $destination} If(Test-path $destination) {Remove-item $destination}
Add-Type -assembly "system.io.compression.filesystem" Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::CreateFromDirectory($source, $destination) [io.compression.zipfile]::CreateFromDirectory($source, $destination)
@@ -117,8 +117,8 @@ If(Test-path $destination) {Remove-item $destination}
# Build MQTTnet.Server Windows-x64 # Build MQTTnet.Server Windows-x64
&dotnet publish ..\Source\MQTTnet.Server\MQTTnet.Server.csproj --configuration Release /p:FileVersion=$assemblyVersion /p:Version=$nugetVersion --self-contained --runtime win-x64 &dotnet publish ..\Source\MQTTnet.Server\MQTTnet.Server.csproj --configuration Release /p:FileVersion=$assemblyVersion /p:Version=$nugetVersion --self-contained --runtime win-x64


$source = "..\Source\MQTTnet.Server\bin\Release\netcoreapp3.1\win-x64\publish"
$destination = "..\Source\MQTTnet.Server\bin\MQTTnet.Server-Windows-x64-v$nugetVersion.zip"
$source = (Convert-Path .) + "\..\Source\MQTTnet.Server\bin\Release\netcoreapp3.1\win-x64\publish"
$destination = (Convert-Path .) + "\..\Source\MQTTnet.Server\bin\MQTTnet.Server-Windows-x64-v$nugetVersion.zip"
If(Test-path $destination) {Remove-item $destination} If(Test-path $destination) {Remove-item $destination}
Add-Type -assembly "system.io.compression.filesystem" Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::CreateFromDirectory($source, $destination) [io.compression.zipfile]::CreateFromDirectory($source, $destination)


+ 2
- 2
Documents/Import_CodeSigningKey.md Целия файл

@@ -1,9 +1,9 @@
# Import codeSigningKey.pfx # Import codeSigningKey.pfx
In order to import the key for code signing on a new developer machine use the following command within the VS developer command line: In order to import the key for code signing on a new developer machine use the following command within the VS developer command line:


> sn –i codeSigningKey.pfx VS_KEY_EFCA4C5B6DFD4B4F
sn –i .\codeSigningKey.pfx VS_KEY_62CA73019ED23333


The container name may be different. The container name may be different.


# Check if the assembly has a strong name # Check if the assembly has a strong name
> sn -vf MQTTnet.dll
sn -vf MQTTnet.dll

+ 5
- 5
Source/MQTTnet.AspnetCore/Client/Tcp/TcpConnection.cs Целия файл

@@ -1,13 +1,13 @@
using System;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Http.Features;
using MQTTnet.Exceptions;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.IO.Pipelines; using System.IO.Pipelines;
using System.Net; using System.Net;
using System.Net.Sockets; using System.Net.Sockets;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Http.Features;
using MQTTnet.Exceptions;


namespace MQTTnet.AspNetCore.Client.Tcp namespace MQTTnet.AspNetCore.Client.Tcp
{ {
@@ -43,7 +43,7 @@ namespace MQTTnet.AspNetCore.Client.Tcp
#if NETCOREAPP3_1 #if NETCOREAPP3_1
public override ValueTask DisposeAsync() public override ValueTask DisposeAsync()
#else #else
public Task DisposeAsync()
public new Task DisposeAsync()
#endif #endif
{ {
IsConnected = false; IsConnected = false;


+ 17
- 17
Source/MQTTnet.Server/Mqtt/MqttServerService.cs Целия файл

@@ -21,21 +21,21 @@ namespace MQTTnet.Server.Mqtt
{ {
public class MqttServerService public class MqttServerService
{ {
private readonly ILogger<MqttServerService> _logger;
private readonly MqttSettingsModel _settings;
private readonly MqttApplicationMessageInterceptor _mqttApplicationMessageInterceptor;
private readonly MqttServerStorage _mqttServerStorage;
private readonly MqttClientConnectedHandler _mqttClientConnectedHandler;
private readonly MqttClientDisconnectedHandler _mqttClientDisconnectedHandler;
private readonly MqttClientSubscribedTopicHandler _mqttClientSubscribedTopicHandler;
private readonly MqttClientUnsubscribedTopicHandler _mqttClientUnsubscribedTopicHandler;
private readonly MqttServerConnectionValidator _mqttConnectionValidator;
private readonly IMqttServer _mqttServer;
private readonly MqttSubscriptionInterceptor _mqttSubscriptionInterceptor;
private readonly MqttUnsubscriptionInterceptor _mqttUnsubscriptionInterceptor;
private readonly PythonScriptHostService _pythonScriptHostService;
private readonly MqttWebSocketServerAdapter _webSocketServerAdapter;
readonly ILogger<MqttServerService> _logger;
readonly MqttSettingsModel _settings;
readonly MqttApplicationMessageInterceptor _mqttApplicationMessageInterceptor;
readonly MqttServerStorage _mqttServerStorage;
readonly MqttClientConnectedHandler _mqttClientConnectedHandler;
readonly MqttClientDisconnectedHandler _mqttClientDisconnectedHandler;
readonly MqttClientSubscribedTopicHandler _mqttClientSubscribedTopicHandler;
readonly MqttClientUnsubscribedTopicHandler _mqttClientUnsubscribedTopicHandler;
readonly MqttServerConnectionValidator _mqttConnectionValidator;
readonly IMqttServer _mqttServer;
readonly MqttSubscriptionInterceptor _mqttSubscriptionInterceptor;
readonly MqttUnsubscriptionInterceptor _mqttUnsubscriptionInterceptor;
readonly PythonScriptHostService _pythonScriptHostService;
readonly MqttWebSocketServerAdapter _webSocketServerAdapter;


public MqttServerService( public MqttServerService(
MqttSettingsModel mqttSettings, MqttSettingsModel mqttSettings,
@@ -127,7 +127,7 @@ namespace MQTTnet.Server.Mqtt
return _mqttServer.PublishAsync(applicationMessage); return _mqttServer.PublishAsync(applicationMessage);
} }


private void Publish(PythonDictionary parameters)
void Publish(PythonDictionary parameters)
{ {
try try
{ {
@@ -173,7 +173,7 @@ namespace MQTTnet.Server.Mqtt
} }
} }


private IMqttServerOptions CreateMqttServerOptions()
IMqttServerOptions CreateMqttServerOptions()
{ {
var options = new MqttServerOptionsBuilder() var options = new MqttServerOptionsBuilder()
.WithMaxPendingMessagesPerClient(_settings.MaxPendingMessagesPerClient) .WithMaxPendingMessagesPerClient(_settings.MaxPendingMessagesPerClient)


+ 15
- 7
Source/MQTTnet.Server/Program.cs Целия файл

@@ -1,8 +1,8 @@
using System;
using System.Reflection;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using MQTTnet.Server.Web; using MQTTnet.Server.Web;
using System;
using System.Reflection;


namespace MQTTnet.Server namespace MQTTnet.Server
{ {
@@ -14,7 +14,15 @@ namespace MQTTnet.Server
{ {
PrintLogo(); PrintLogo();


WebHost.CreateDefaultBuilder(args).UseStartup<Startup>().Build().Run();
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.ConfigureKestrel(serverOptions =>
{
})
.UseStartup<Startup>();

}).Build().Run();


return 0; return 0;
} }
@@ -25,7 +33,7 @@ namespace MQTTnet.Server
} }
} }


private static void PrintLogo()
static void PrintLogo()
{ {
Console.ResetColor(); Console.ResetColor();
Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.Red;
@@ -46,7 +54,7 @@ namespace MQTTnet.Server
Console.WriteLine(); Console.WriteLine();
Console.ForegroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("The official MQTT server implementation of MQTTnet"); Console.WriteLine("The official MQTT server implementation of MQTTnet");
Console.WriteLine("Copyright (c) 2017-2019 The MQTTnet Team");
Console.WriteLine("Copyright (c) 2017-2020 The MQTTnet Team");
Console.WriteLine(@"https://github.com/chkr1011/MQTTnet"); Console.WriteLine(@"https://github.com/chkr1011/MQTTnet");


Console.ForegroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.White;


+ 12
- 17
Source/MQTTnet.Server/Web/Startup.cs Целия файл

@@ -1,6 +1,5 @@
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@@ -36,33 +35,27 @@ namespace MQTTnet.Server.Web


public void Configure( public void Configure(
IApplicationBuilder application, IApplicationBuilder application,
IHostingEnvironment environment,
MqttServerService mqttServerService, MqttServerService mqttServerService,
PythonScriptHostService pythonScriptHostService, PythonScriptHostService pythonScriptHostService,
DataSharingService dataSharingService, DataSharingService dataSharingService,
MqttSettingsModel mqttSettings) MqttSettingsModel mqttSettings)
{ {
if (environment.IsDevelopment())
{
application.UseDeveloperExceptionPage();
}
else
{
application.UseHsts();
}

application.UseHsts();
application.UseRouting();
application.UseCors(x => x application.UseCors(x => x
.AllowAnyOrigin() .AllowAnyOrigin()
.AllowAnyMethod() .AllowAnyMethod()
.AllowAnyHeader()
.AllowCredentials());
.AllowAnyHeader());


application.UseAuthentication(); application.UseAuthentication();
application.UseAuthorization();


application.UseStaticFiles(); application.UseStaticFiles();


application.UseHttpsRedirection();
application.UseMvc();
application.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});


ConfigureWebSocketEndpoint(application, mqttServerService, mqttSettings); ConfigureWebSocketEndpoint(application, mqttServerService, mqttSettings);


@@ -88,6 +81,9 @@ namespace MQTTnet.Server.Web
{ {
services.AddCors(); services.AddCors();



services.AddControllers();

services.AddMvc() services.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Version_3_0) .SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
.AddNewtonsoftJson(o => .AddNewtonsoftJson(o =>
@@ -112,12 +108,11 @@ namespace MQTTnet.Server.Web
services.AddSingleton<MqttClientUnsubscribedTopicHandler>(); services.AddSingleton<MqttClientUnsubscribedTopicHandler>();
services.AddSingleton<MqttServerConnectionValidator>(); services.AddSingleton<MqttServerConnectionValidator>();
services.AddSingleton<MqttSubscriptionInterceptor>(); services.AddSingleton<MqttSubscriptionInterceptor>();
services.AddSingleton<MqttUnsubscriptionInterceptor>();
services.AddSingleton<MqttApplicationMessageInterceptor>(); services.AddSingleton<MqttApplicationMessageInterceptor>();


services.AddSwaggerGen(c => services.AddSwaggerGen(c =>
{ {
c.DescribeAllEnumsAsStrings();

var securityScheme = new OpenApiSecurityScheme var securityScheme = new OpenApiSecurityScheme
{ {
Scheme = "Basic", Scheme = "Basic",


+ 2
- 0
Source/MQTTnet/Diagnostics/MqttNetLogMessagePublishedEventArgs.cs Целия файл

@@ -8,7 +8,9 @@ namespace MQTTnet.Diagnostics
{ {
LogMessage = logMessage ?? throw new ArgumentNullException(nameof(logMessage)); LogMessage = logMessage ?? throw new ArgumentNullException(nameof(logMessage));


#pragma warning disable CS0618 // Type or member is obsolete
TraceMessage = logMessage ?? throw new ArgumentNullException(nameof(logMessage)); TraceMessage = logMessage ?? throw new ArgumentNullException(nameof(logMessage));
#pragma warning restore CS0618 // Type or member is obsolete
} }


[Obsolete("Use new proeprty LogMessage instead.")] [Obsolete("Use new proeprty LogMessage instead.")]


+ 1
- 1
Tests/MQTTnet.Core.Tests/CrossPlatformSocket_Tests.cs Целия файл

@@ -58,7 +58,7 @@ namespace MQTTnet.Tests
//} //}


[TestMethod] [TestMethod]
public async Task Set_Options()
public void Set_Options()
{ {
var crossPlatformSocket = new CrossPlatformSocket(); var crossPlatformSocket = new CrossPlatformSocket();




+ 5
- 1
Tests/MQTTnet.Core.Tests/Mockups/TestLogger.cs Целия файл

@@ -34,7 +34,11 @@ namespace MQTTnet.Tests.Mockups


public void Publish(MqttNetLogLevel logLevel, string message, object[] parameters, Exception exception) public void Publish(MqttNetLogLevel logLevel, string message, object[] parameters, Exception exception)
{ {
throw new NotImplementedException();
LogMessagePublished?.Invoke(this, new MqttNetLogMessagePublishedEventArgs(new MqttNetLogMessage
{
Level = logLevel,
Message = message
}));
} }
} }
} }

Зареждане…
Отказ
Запис