Browse Source

Renamed MqttServerAdapter to MqttTcpServerAdapter

release/3.x.x
Christian 6 years ago
parent
commit
c06d84e834
5 changed files with 29 additions and 19 deletions
  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 View File

@@ -2,7 +2,7 @@
<package > <package >
<metadata> <metadata>
<id>MQTTnet</id> <id>MQTTnet</id>
<version>2.7.3</version>
<version>2.7.4</version>
<authors>Christian Kratky</authors> <authors>Christian Kratky</authors>
<owners>Christian Kratky</owners> <owners>Christian Kratky</owners>
<licenseUrl>https://github.com/chkr1011/MQTTnet/blob/master/LICENSE</licenseUrl> <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> <iconUrl>https://raw.githubusercontent.com/chkr1011/MQTTnet/master/Images/Logo_128x128.png</iconUrl>
<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).</description> <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> </releaseNotes>
<copyright>Copyright Christian Kratky 2016-2018</copyright> <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> <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 targetFramework="net461">
</group> </group>
<group targetFramework="net462">
</group>
<group targetFramework="net471">
</group>


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

+ 2
- 2
Frameworks/MQTTnet.AspnetCore/ServiceCollectionExtensions.cs View File

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


return services; return services;
} }


Frameworks/MQTTnet.NetStandard/Implementations/MqttServerAdapter.Uwp.cs → Frameworks/MQTTnet.NetStandard/Implementations/MqttTcpServerAdapter.Uwp.cs View File

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


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


public MqttServerAdapter(IMqttNetLogger logger)
public MqttTcpServerAdapter(IMqttNetLogger logger)
{ {
_logger = logger ?? throw new ArgumentNullException(nameof(logger)); _logger = logger ?? throw new ArgumentNullException(nameof(logger));
} }
@@ -67,7 +67,7 @@ namespace MQTTnet.Implementations
} }
catch (Exception exception) 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 View File

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


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


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


public MqttServerAdapter(IMqttNetLogger logger)
public MqttTcpServerAdapter(IMqttNetLogger logger)
{ {
_logger = logger ?? throw new ArgumentNullException(nameof(logger)); _logger = logger ?? throw new ArgumentNullException(nameof(logger));
} }
@@ -117,7 +117,7 @@ namespace MQTTnet.Implementations
return; 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); await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken).ConfigureAwait(false);
} }
} }
@@ -152,7 +152,7 @@ namespace MQTTnet.Implementations
return; 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); await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken).ConfigureAwait(false);
} }
} }

+ 8
- 1
Frameworks/MQTTnet.NetStandard/MqttFactory.cs View File

@@ -38,7 +38,14 @@ namespace MQTTnet
public IMqttServer CreateMqttServer() public IMqttServer CreateMqttServer()
{ {
var logger = new MqttNetLogger(); 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) public IMqttServer CreateMqttServer(IEnumerable<IMqttServerAdapter> adapters, IMqttNetLogger logger)


Loading…
Cancel
Save