Skip to content

Commit

Permalink
MQTT: refactor the producer as a finite state machine
Browse files Browse the repository at this point in the history
Contributes to issue #1385
  • Loading branch information
chriadam committed Aug 6, 2024
1 parent 66ed44b commit 670f0b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/backendconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ void BackendConnection::setState(VeQItemMqttProducer::ConnectionState backendCon
setState(BackendConnection::State::Idle);
break;
}
case VeQItemMqttProducer::WaitingToConnect: // fall through
case VeQItemMqttProducer::TransportConnecting: // fall through
case VeQItemMqttProducer::TransportConnected: // fall through
case VeQItemMqttProducer::Connecting:
{
setState(BackendConnection::State::Connecting);
Expand All @@ -72,6 +75,7 @@ void BackendConnection::setState(VeQItemMqttProducer::ConnectionState backendCon
setState(BackendConnection::State::Connected);
break;
}
case VeQItemMqttProducer::Identified: // fall through
case VeQItemMqttProducer::Initializing:
{
setState(BackendConnection::State::Initializing);
Expand All @@ -87,6 +91,9 @@ void BackendConnection::setState(VeQItemMqttProducer::ConnectionState backendCon
setState(BackendConnection::State::Disconnected);
break;
}
case VeQItemMqttProducer::WaitingToReconnect: // fall through
case VeQItemMqttProducer::TransportReconnecting: // fall through
case VeQItemMqttProducer::TransportReconnected: // fall through
case VeQItemMqttProducer::Reconnecting:
{
setState(BackendConnection::State::Reconnecting);
Expand Down
2 changes: 1 addition & 1 deletion src/veutil

0 comments on commit 670f0b9

Please sign in to comment.