mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-19 11:03:07 +08:00
Refactoring
This commit is contained in:
+7
-1
@@ -7,7 +7,7 @@ namespace MQTTnet.Implementations
|
||||
{
|
||||
public class MqttCommunicationAdapterFactory : IMqttCommunicationAdapterFactory
|
||||
{
|
||||
public IMqttCommunicationAdapter CreateMqttCommunicationAdapter(MqttClientQueuedOptions options)
|
||||
public IMqttCommunicationAdapter CreateMqttCommunicationAdapter(MqttClientOptions options)
|
||||
{
|
||||
if (options == null) throw new ArgumentNullException(nameof(options));
|
||||
|
||||
@@ -21,6 +21,12 @@ namespace MQTTnet.Implementations
|
||||
return new MqttChannelCommunicationAdapter(new MqttWebSocketChannel(webSocketOptions), new MqttPacketSerializer { ProtocolVersion = options.ProtocolVersion });
|
||||
}
|
||||
|
||||
if (options is MqttClientQueuedOptions queuedOptions)
|
||||
{
|
||||
return new MqttChannelCommunicationAdapter(new MqttTcpChannel(queuedOptions), new MqttPacketSerializer { ProtocolVersion = options.ProtocolVersion });
|
||||
}
|
||||
|
||||
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace MQTTnet.Implementations
|
||||
RawReceiveStream = ReceiveStream;
|
||||
}
|
||||
|
||||
private static Certificate LoadCertificate(MqttClientQueuedOptions options)
|
||||
private static Certificate LoadCertificate(MqttClientOptions options)
|
||||
{
|
||||
if (options.TlsOptions.Certificates == null || !options.TlsOptions.Certificates.Any())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user