net: app: Do not reset net_context information

Do not reset net_context information in net_app_close. In case of
TCP behind the curtains connection might wait for some timers to
expire and send some messages (e.g. ACK). If we set source port to
'0', unexpected behaviour might happen with peer connection.
Only reset net_app context related information on net_app_close.
Let net_context_put will take care of proper connection closure.

Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
This commit is contained in:
Ravi kumar Veeramally 2017-12-19 16:16:01 +02:00 committed by Anas Nashif
parent a0371ae92f
commit 1e277e0f20

View file

@ -1045,17 +1045,9 @@ int net_app_close(struct net_app_ctx *ctx)
*/
#if defined(CONFIG_NET_IPV4)
net_sin(&ctx->ipv4.local)->sin_port = 0;
if (ctx->ipv4.ctx) {
net_sin_ptr(&ctx->ipv4.ctx->local)->sin_port = 0;
}
#endif
#if defined(CONFIG_NET_IPV6)
net_sin6(&ctx->ipv6.local)->sin6_port = 0;
if (ctx->ipv6.ctx) {
net_sin6_ptr(&ctx->ipv6.ctx->local)->sin6_port = 0;
}
#endif
}
#endif
@ -1110,17 +1102,9 @@ int net_app_close2(struct net_app_ctx *ctx, struct net_context *net_ctx)
*/
#if defined(CONFIG_NET_IPV4)
net_sin(&ctx->ipv4.local)->sin_port = 0;
if (net_ctx == ctx->ipv4.ctx) {
net_sin_ptr(&ctx->ipv4.ctx->local)->sin_port = 0;
}
#endif
#if defined(CONFIG_NET_IPV6)
net_sin6(&ctx->ipv6.local)->sin6_port = 0;
if (net_ctx == ctx->ipv6.ctx) {
net_sin6_ptr(&ctx->ipv6.ctx->local)->sin6_port = 0;
}
#endif
}
#endif