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

net: lwm2m: Check result when sending messages #84867

Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion subsys/net/lib/lwm2m/lwm2m_message_handling.c
Original file line number Diff line number Diff line change
Expand Up @@ -2912,7 +2912,12 @@ void lwm2m_udp_receive(struct lwm2m_ctx *client_ctx, uint8_t *buf, uint16_t buf_
}

client_ctx->processed_req = NULL;
lwm2m_send_message_async(msg);
r = lwm2m_send_message_async(msg);
if (r < 0) {
LOG_ERR("Failed to send response (err: %d)", r);
lwm2m_reset_message(msg, true);
return;
}
} else {
LOG_DBG("No handler for response");
}
Expand Down
17 changes: 14 additions & 3 deletions subsys/net/lib/lwm2m/lwm2m_rd_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,11 @@ static int sm_send_bootstrap_registration(void)
LOG_DBG("Register ID with bootstrap server as '%s'",
query_buffer);

lwm2m_send_message_async(msg);
ret = lwm2m_send_message_async(msg);
if (ret < 0) {
LOG_ERR("Failed to send bootstrap message (err: %d)", ret);
goto cleanup;
}

return 0;

Expand Down Expand Up @@ -987,7 +991,10 @@ static int sm_send_registration(bool send_obj_support_data,
}
}

lwm2m_send_message_async(msg);
ret = lwm2m_send_message_async(msg);
if (ret < 0) {
goto cleanup;
}

/* log the registration attempt */
LOG_DBG("registration sent [%s]",
Expand Down Expand Up @@ -1259,7 +1266,11 @@ static int sm_do_deregister(void)

LOG_INF("Deregister from '%s'", client.server_ep);

lwm2m_send_message_async(msg);
ret = lwm2m_send_message_async(msg);
if (ret < 0) {
LOG_ERR("Failed to send deregistration message (err:%d).", ret);
goto cleanup;
}

set_sm_state(ENGINE_DEREGISTER_SENT);
return 0;
Expand Down
Loading