Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix: Direct method subscription not removed after disconnect #3359

3 changes: 3 additions & 0 deletions iothub/device/src/Pipeline/MqttTransportHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,9 @@ private Task HandleDisconnectionAsync(MqttClientDisconnectedEventArgs disconnect
// During a disconnection, any pending twin updates won't be received, so we'll preemptively
// cancel these operations so the client can retry once reconnected.
RemoveOldOperations(TimeSpan.Zero);

_mqttClient.DisconnectedAsync -= HandleDisconnectionAsync;
tmahmood-microsoft marked this conversation as resolved.
Show resolved Hide resolved
_mqttClient.ApplicationMessageReceivedAsync -= HandleReceivedMessageAsync;
}

return Task.CompletedTask;
Expand Down