diff --git a/Source/MQTTnet/Adapter/MqttConnectingFailedException.cs b/Source/MQTTnet/Adapter/MqttConnectingFailedException.cs index 44d50ec..ab49d93 100644 --- a/Source/MQTTnet/Adapter/MqttConnectingFailedException.cs +++ b/Source/MQTTnet/Adapter/MqttConnectingFailedException.cs @@ -5,12 +5,13 @@ namespace MQTTnet.Adapter { public class MqttConnectingFailedException : MqttCommunicationException { - public MqttConnectingFailedException(MqttClientConnectResultCode resultCode) - : base($"Connecting with MQTT server failed ({resultCode.ToString()}).") + public MqttConnectingFailedException(MqttClientAuthenticateResult result) + : base($"Connecting with MQTT server failed ({result.ResultCode.ToString()}).") { - ResultCode = resultCode; + Result = result; } - public MqttClientConnectResultCode ResultCode { get; } + public MqttClientAuthenticateResult Result { get; } + public MqttClientConnectResultCode ResultCode => Result.ResultCode; } } diff --git a/Source/MQTTnet/Client/MqttClient.cs b/Source/MQTTnet/Client/MqttClient.cs index c9ef061..4d8269d 100644 --- a/Source/MQTTnet/Client/MqttClient.cs +++ b/Source/MQTTnet/Client/MqttClient.cs @@ -255,7 +255,7 @@ namespace MQTTnet.Client if (result.ResultCode != MqttClientConnectResultCode.Success) { - throw new MqttConnectingFailedException(result.ResultCode); + throw new MqttConnectingFailedException(result); } _logger.Verbose("Authenticated MQTT connection with server established."); diff --git a/Source/MQTTnet/Formatter/V5/MqttV500DataConverter.cs b/Source/MQTTnet/Formatter/V5/MqttV500DataConverter.cs index 42d3241..886b937 100644 --- a/Source/MQTTnet/Formatter/V5/MqttV500DataConverter.cs +++ b/Source/MQTTnet/Formatter/V5/MqttV500DataConverter.cs @@ -139,7 +139,7 @@ namespace MQTTnet.Formatter.V5 ReasonCode = connectionValidatorContext.ReasonCode, Properties = new MqttConnAckPacketProperties { - UserProperties = connectionValidatorContext.UserProperties, + UserProperties = connectionValidatorContext.ResponseUserProperties, AuthenticationMethod = connectionValidatorContext.AuthenticationMethod, AuthenticationData = connectionValidatorContext.ResponseAuthenticationData, AssignedClientIdentifier = connectionValidatorContext.AssignedClientIdentifier,