Added stopping for subscriptions handlers and for unsubscription handlers

This commit is contained in:
zbeacon 2021-11-08 13:25:03 +02:00 committed by Andrew Shvayka
parent e7c4e76851
commit 06f199b936
4 changed files with 14 additions and 4 deletions

View File

@ -156,9 +156,11 @@ final class MqttClientImpl implements MqttClient {
if (callback != null) {
callback.connectionLost(e);
}
pendingSubscriptions.forEach((id, mqttPendingSubscription) -> mqttPendingSubscription.onChannelClosed());
pendingSubscriptions.clear();
serverSubscriptions.clear();
subscriptions.clear();
pendingServerUnsubscribes.forEach((id, mqttPendingServerUnsubscribes) -> mqttPendingServerUnsubscribes.onChannelClosed());
pendingServerUnsubscribes.clear();
qos2PendingIncomingPublishes.clear();
pendingPublishes.forEach((id, mqttPendingPublish) -> mqttPendingPublish.onChannelClosed());

View File

@ -99,4 +99,8 @@ final class MqttPendingSubscription {
return once;
}
}
void onChannelClosed(){
this.retransmissionHandler.stop();
}
}

View File

@ -52,4 +52,8 @@ final class MqttPendingUnsubscription {
void onUnsubackReceived(){
this.retransmissionHandler.stop();
}
void onChannelClosed(){
this.retransmissionHandler.stop();
}
}