Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/wakaama/client_connection: destroy unused DTLS sessions #21035

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -104,7 +104,7 @@
lwm2m_client_data_t *client_data = (lwm2m_client_data_t *)user_data;
lwm2m_client_connection_t *new_conn;

DEBUG("[lwm2m_connect_server] Connecting to server in security instance %" PRIu16 "\n", sec_obj_inst_id);

Check warning on line 107 in pkg/wakaama/contrib/lwm2m_client_connection.c

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters

new_conn = _connection_create(sec_obj_inst_id, client_data);
if (new_conn) {
Expand Down Expand Up @@ -382,13 +382,15 @@
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
Loading