mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-15 17:00:03 +08:00
* rethrow MqttClientUnexpectedDisconnectReceivedException when Publish errors out because server disconnects the client and QoS is 0 * use a local var to cache _unexpectedDisconnectPacket * Add inner exception to new exception * Update release notes * set the default inner exception as null --------- Co-authored-by: christian <6939810+chkr1011@users.noreply.github.com>
36 lines
1.3 KiB
C#
36 lines
1.3 KiB
C#
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using MQTTnet.Exceptions;
|
|
using MQTTnet.Packets;
|
|
using MQTTnet.Protocol;
|
|
|
|
namespace MQTTnet.Client
|
|
{
|
|
public sealed class MqttClientUnexpectedDisconnectReceivedException : MqttCommunicationException
|
|
{
|
|
public MqttClientUnexpectedDisconnectReceivedException(MqttDisconnectPacket disconnectPacket, Exception innerExcpetion = null) : base(
|
|
$"Unexpected DISCONNECT (Reason code={disconnectPacket.ReasonCode}) received.",
|
|
innerExcpetion)
|
|
{
|
|
ReasonCode = disconnectPacket.ReasonCode;
|
|
SessionExpiryInterval = disconnectPacket.SessionExpiryInterval;
|
|
ReasonString = disconnectPacket.ReasonString;
|
|
ServerReference = disconnectPacket.ServerReference;
|
|
UserProperties = disconnectPacket.UserProperties;
|
|
}
|
|
|
|
public MqttDisconnectReasonCode? ReasonCode { get; }
|
|
|
|
public string ReasonString { get; }
|
|
|
|
public string ServerReference { get; }
|
|
|
|
public uint? SessionExpiryInterval { get; }
|
|
|
|
public List<MqttUserProperty> UserProperties { get; }
|
|
}
|
|
} |