Skip to content

Commit

Permalink
net: sockets: Be sure to initialize socket's queue on accept
Browse files Browse the repository at this point in the history
When new socket context is created on accepting connection to a
listening socket, its recv_q FIFO should be initialized. Without
initialization, this worked by a chance when FIFO structure was
simple, but recent change to add dlist to it (which now needs
proper initialization) exposed this issue.

Jira: ZEP-2576

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
  • Loading branch information
pfalcon authored and Anas Nashif committed Aug 31, 2017
1 parent bd425e6 commit eb5d6fc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions subsys/net/lib/sockets/sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ static void zsock_accepted_cb(struct net_context *new_ctx,
struct net_context *parent = user_data;

net_context_recv(new_ctx, zsock_received_cb, K_NO_WAIT, NULL);
k_fifo_init(&new_ctx->recv_q);

NET_DBG("parent=%p, ctx=%p, st=%d", parent, new_ctx, status);

Expand Down

0 comments on commit eb5d6fc

Please sign in to comment.