Skip to content

Commit

Permalink
Merge pull request #145 from sorru94/fix-disconnection-state
Browse files Browse the repository at this point in the history
Fix disconnection state
  • Loading branch information
harlem88 authored Jun 26, 2024
2 parents 875bf6c + b0a30bf commit f4b3815
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/astarte_device_sdk/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ static void on_disconnected_handler(astarte_mqtt_t *astarte_mqtt)
{
struct astarte_device *device = CONTAINER_OF(astarte_mqtt, struct astarte_device, astarte_mqtt);

device->connection_state = DEVICE_DISCONNECTED;

if (device->disconnection_cbk) {
astarte_device_disconnection_event_t event = {
.device = device,
Expand All @@ -286,8 +288,6 @@ static void on_disconnected_handler(astarte_mqtt_t *astarte_mqtt)

device->disconnection_cbk(event);
}

device->connection_state = DEVICE_DISCONNECTED;
}

static void on_incoming_handler(astarte_mqtt_t *astarte_mqtt, const char *topic, size_t topic_len,
Expand Down

0 comments on commit f4b3815

Please sign in to comment.