void Close(DisconnectedReason reason, string message = null) { tracer.Info(Properties.Resources.Client_Closing, Id, reason); CloseClientSession(); packetsSubscription?.Dispose(); packetListener?.Dispose(); Channel?.Dispose(); IsConnected = false; Id = null; Disconnected(this, new MqttEndpointDisconnected(reason, message)); }
void Close(DisconnectedReason reason, string message = null) { tracer.Info(Properties.Resources.Client_Disposing, Id, reason); receiver?.OnCompleted(); packetsSubscription?.Dispose(); packetListener?.Dispose(); packetChannel?.Dispose(); (clientSender as IDisposable)?.Dispose(); IsConnected = false; Id = null; Disconnected(this, new MqttEndpointDisconnected(reason, message)); }