diff --git a/src/coap_client_libcoap.c b/src/coap_client_libcoap.c index 897f0a179..dcc4658a8 100644 --- a/src/coap_client_libcoap.c +++ b/src/coap_client_libcoap.c @@ -1241,6 +1241,7 @@ static void golioth_coap_client_thread(void *arg) cleanup: GLTH_LOGI(TAG, "Ending session"); + golioth_sys_client_disconnected(client); if (client->event_callback && client->session_connected) { client->event_callback(client, @@ -1388,6 +1389,10 @@ void golioth_client_destroy(struct golioth_client *client) { return; } + if (client->is_running) + { + golioth_client_stop(client); + } if (client->keepalive_timer) { golioth_sys_timer_destroy(client->keepalive_timer);