Parcourir la source

Provide the full ACK on a connection failure

There are some systems that return information on a failed exception and thus the client wants access to the full set of ACK information.  Specifically the user properties.
release/3.x.x
Jim Schaad il y a 5 ans
Parent
révision
9c378fb088
2 fichiers modifiés avec 5 ajouts et 4 suppressions
  1. +4
    -3
      Source/MQTTnet/Adapter/MqttConnectingFailedException.cs
  2. +1
    -1
      Source/MQTTnet/Client/MqttClient.cs

+ 4
- 3
Source/MQTTnet/Adapter/MqttConnectingFailedException.cs Voir le fichier

@@ -5,12 +5,13 @@ namespace MQTTnet.Adapter
{
public class MqttConnectingFailedException : MqttCommunicationException
{
public MqttConnectingFailedException(MqttClientConnectResultCode resultCode)
public MqttConnectingFailedException(MqttClientAuthenticateResult resultCode)
: base($"Connecting with MQTT server failed ({resultCode.ToString()}).")
{
ResultCode = resultCode;
Result = resultCode;
}

public MqttClientConnectResultCode ResultCode { get; }
public MqttClientAuthenticateResult Result { get; }
public MqttClientConnectResultCode ResultCode => Result.ResultCode;
}
}

+ 1
- 1
Source/MQTTnet/Client/MqttClient.cs Voir le fichier

@@ -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.");


Chargement…
Annuler
Enregistrer