net: lwm2m: separate closing context from closing socket
Separate closing lwm2m context from closing socket. This patch is required for the rd client to take more control over lwm2m context and the socket. The goal is to close the socket and to keep the lwm2m context if this is needed. Signed-off-by: Andreas Chmielewski <andreas.chmielewski@grandcentrix.net>
This commit is contained in:
parent
3cdff65eb0
commit
74a56b05a9
6 changed files with 51 additions and 25 deletions
|
@ -172,9 +172,8 @@ static void free_block_ctx(struct lwm2m_block_context *ctx)
|
|||
ctx->tkl = 0U;
|
||||
}
|
||||
|
||||
int lwm2m_engine_context_close(struct lwm2m_ctx *client_ctx)
|
||||
void lwm2m_engine_context_close(struct lwm2m_ctx *client_ctx)
|
||||
{
|
||||
int sock_fd = client_ctx->sock_fd;
|
||||
struct lwm2m_message *msg;
|
||||
sys_snode_t *obs_node;
|
||||
struct observe_node *obs;
|
||||
|
@ -201,13 +200,6 @@ int lwm2m_engine_context_close(struct lwm2m_ctx *client_ctx)
|
|||
#if defined(CONFIG_LWM2M_QUEUE_MODE_ENABLED)
|
||||
client_ctx->buffer_client_messages = true;
|
||||
#endif
|
||||
lwm2m_socket_del(client_ctx);
|
||||
client_ctx->sock_fd = -1;
|
||||
if (sock_fd >= 0) {
|
||||
return close(sock_fd);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void lwm2m_engine_context_init(struct lwm2m_ctx *client_ctx)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue