Skip to content

Commit

Permalink
Merge pull request #21035 from leandrolanzieri/pr/wakaama/destroy_unu…
Browse files Browse the repository at this point in the history
…sed_dtls_sessions

pkg/wakaama/client_connection: destroy unused DTLS sessions
  • Loading branch information
Teufelchen1 authored Nov 25, 2024
2 parents 3a7f3b4 + 22f7799 commit 71e6c86
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/wakaama/contrib/lwm2m_client_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,15 @@ static lwm2m_client_connection_t *_connection_create(uint16_t sec_obj_inst_id,
res = sock_dtls_session_init(&client_data->dtls_sock, &conn->remote, &conn->session);
if (res <= 0) {
DEBUG("[lwm2m:client] could not initiate DTLS session\n");
sock_dtls_session_destroy(&client_data->dtls_sock, &conn->session);
goto free_out;
}

DEBUG("[lwm2m:client] receiving DTLS handshake\n");
res = sock_dtls_recv(&client_data->dtls_sock, &conn->session, buf, sizeof(buf), US_PER_SEC);
if (res != -SOCK_DTLS_HANDSHAKE) {
DEBUG("[lwm2m:client] error creating session: %i\n", res);
sock_dtls_session_destroy(&client_data->dtls_sock, &conn->session);
goto free_out;
}
DEBUG("[lwm2m:client] connection to server successful\n");
Expand Down

0 comments on commit 71e6c86

Please sign in to comment.