net: app: Check that we could install recv_cb after connected

Inform user if we could not install receive callback after
a connection is created in net-app client.

Coverity-CID: 178246
Fixes #4582

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2017-10-27 14:29:20 +03:00
parent 9a61384b86
commit b68ee59335
1 changed files with 5 additions and 1 deletions

View File

@ -469,6 +469,7 @@ static void _app_connected(struct net_context *net_ctx,
void *user_data)
{
struct net_app_ctx *ctx = user_data;
int ret;
#if defined(CONFIG_NET_APP_TLS) || defined(CONFIG_NET_APP_DTLS)
if (ctx->is_tls) {
@ -476,7 +477,10 @@ static void _app_connected(struct net_context *net_ctx,
}
#endif
net_context_recv(net_ctx, ctx->recv_cb, K_NO_WAIT, ctx);
ret = net_context_recv(net_ctx, ctx->recv_cb, K_NO_WAIT, ctx);
if (ret < 0) {
NET_DBG("Cannot set recv_cb (%d)", ret);
}
#if defined(CONFIG_NET_APP_TLS) || defined(CONFIG_NET_APP_DTLS)
if (ctx->is_tls) {