浏览代码

Renamed MqttServerAdapter to MqttTcpServerAdapter

release/3.x.x
Christian 6 年前
父节点
当前提交
c06d84e834
共有 5 个文件被更改,包括 29 次插入19 次删除
  1. +12
    -9
      Build/MQTTnet.nuspec
  2. +2
    -2
      Frameworks/MQTTnet.AspnetCore/ServiceCollectionExtensions.cs
  3. +3
    -3
      Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpServerAdapter.Uwp.cs
  4. +4
    -4
      Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpServerAdapter.cs
  5. +8
    -1
      Frameworks/MQTTnet.NetStandard/MqttFactory.cs

+ 12
- 9
Build/MQTTnet.nuspec 查看文件

@@ -2,7 +2,7 @@
<package >
<metadata>
<id>MQTTnet</id>
<version>2.7.3</version>
<version>2.7.4</version>
<authors>Christian Kratky</authors>
<owners>Christian Kratky</owners>
<licenseUrl>https://github.com/chkr1011/MQTTnet/blob/master/LICENSE</licenseUrl>
@@ -10,14 +10,9 @@
<iconUrl>https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png</iconUrl>
<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).</description>
<releaseNotes>* [Core] Add several new extension methods.
* [Client] Fixed an issue in _ManagedMqttClientOptionsBuilder_ when using _WithClientOptions_ and an options builder.
* [Client] Added the "IsStarted" property for the managed client.
* [Client] Optimized stream buffer for UWP apps.
* [Client] Added the _BufferSize_ to the TCP options.
* [Client] Fixed a race condition which leads to exceptions when reconnecting rapidly.
* [Server] Fixed a race condition which leads to exceptions when clients are reconnecting rapidly.
* [Core] Fixed some issues in stream and socket handling.
<releaseNotes>
* [Server] The _MqttTcpServerAdapter_ is now added to the ASP.NET services.
* [Server] _MqttServerAdapter_ is renamed to _MqttTcpServerAdapter_ (BREAKING CHANGE!).
</releaseNotes>
<copyright>Copyright Christian Kratky 2016-2018</copyright>
<tags>MQTT Message Queue Telemetry Transport MQTTClient MQTTServer Server MQTTBroker Broker NETStandard IoT InternetOfThings Messaging Hardware Arduino Sensor Actuator M2M ESP Smart Home Cities Automation Xamarin</tags>
@@ -46,6 +41,12 @@

<group targetFramework="net461">
</group>
<group targetFramework="net462">
</group>
<group targetFramework="net471">
</group>

</dependencies>
</metadata>
@@ -64,6 +65,8 @@
<!-- .NET Framework -->
<file src="..\Frameworks\MQTTnet.Netstandard\bin\Release\net452\MQTTnet.*" target="lib\net452\"/>
<file src="..\Frameworks\MQTTnet.Netstandard\bin\Release\net461\MQTTnet.*" target="lib\net461\"/>
<file src="..\Frameworks\MQTTnet.Netstandard\bin\Release\net462\MQTTnet.*" target="lib\net462\"/>
<file src="..\Frameworks\MQTTnet.Netstandard\bin\Release\net471\MQTTnet.*" target="lib\net471\"/>
</files>
</package>

+ 2
- 2
Frameworks/MQTTnet.AspnetCore/ServiceCollectionExtensions.cs 查看文件

@@ -21,9 +21,9 @@ namespace MQTTnet.AspNetCore
services.AddSingleton<IMqttServer>(s => s.GetService<MqttHostedServer>());
services.AddSingleton<MqttWebSocketServerAdapter>();
services.AddSingleton<MqttServerAdapter>();
services.AddSingleton<MqttTcpServerAdapter>();
services.AddSingleton<IMqttServerAdapter>(s => s.GetService<MqttWebSocketServerAdapter>());
services.AddSingleton<IMqttServerAdapter>(s => s.GetService<MqttServerAdapter>());
services.AddSingleton<IMqttServerAdapter>(s => s.GetService<MqttTcpServerAdapter>());

return services;
}


Frameworks/MQTTnet.NetStandard/Implementations/MqttServerAdapter.Uwp.cs → Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpServerAdapter.Uwp.cs 查看文件

@@ -9,12 +9,12 @@ using MQTTnet.Server;

namespace MQTTnet.Implementations
{
public class MqttServerAdapter : IMqttServerAdapter, IDisposable
public class MqttTcpServerAdapter : IMqttServerAdapter, IDisposable
{
private readonly IMqttNetLogger _logger;
private StreamSocketListener _defaultEndpointSocket;

public MqttServerAdapter(IMqttNetLogger logger)
public MqttTcpServerAdapter(IMqttNetLogger logger)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}
@@ -67,7 +67,7 @@ namespace MQTTnet.Implementations
}
catch (Exception exception)
{
_logger.Error<MqttServerAdapter>(exception, "Error while accepting connection at default endpoint.");
_logger.Error<MqttTcpServerAdapter>(exception, "Error while accepting connection at default endpoint.");
}
}
}

Frameworks/MQTTnet.NetStandard/Implementations/MqttServerAdapter.cs → Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpServerAdapter.cs 查看文件

@@ -14,7 +14,7 @@ using MQTTnet.Server;

namespace MQTTnet.Implementations
{
public class MqttServerAdapter : IMqttServerAdapter, IDisposable
public class MqttTcpServerAdapter : IMqttServerAdapter, IDisposable
{
private readonly IMqttNetLogger _logger;

@@ -23,7 +23,7 @@ namespace MQTTnet.Implementations
private Socket _tlsEndpointSocket;
private X509Certificate2 _tlsCertificate;

public MqttServerAdapter(IMqttNetLogger logger)
public MqttTcpServerAdapter(IMqttNetLogger logger)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}
@@ -117,7 +117,7 @@ namespace MQTTnet.Implementations
return;
}

_logger.Error<MqttServerAdapter>(exception, "Error while accepting connection at default endpoint.");
_logger.Error<MqttTcpServerAdapter>(exception, "Error while accepting connection at default endpoint.");
await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken).ConfigureAwait(false);
}
}
@@ -152,7 +152,7 @@ namespace MQTTnet.Implementations
return;
}

_logger.Error<MqttServerAdapter>(exception, "Error while accepting connection at TLS endpoint.");
_logger.Error<MqttTcpServerAdapter>(exception, "Error while accepting connection at TLS endpoint.");
await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken).ConfigureAwait(false);
}
}

+ 8
- 1
Frameworks/MQTTnet.NetStandard/MqttFactory.cs 查看文件

@@ -38,7 +38,14 @@ namespace MQTTnet
public IMqttServer CreateMqttServer()
{
var logger = new MqttNetLogger();
return CreateMqttServer(new List<IMqttServerAdapter> { new MqttServerAdapter(logger) }, logger);
return CreateMqttServer(logger);
}

public IMqttServer CreateMqttServer(IMqttNetLogger logger)
{
if (logger == null) throw new ArgumentNullException(nameof(logger));

return CreateMqttServer(new List<IMqttServerAdapter> { new MqttTcpServerAdapter(logger) }, logger);
}

public IMqttServer CreateMqttServer(IEnumerable<IMqttServerAdapter> adapters, IMqttNetLogger logger)


正在加载...
取消
保存