samples: net: Do not assume TCP connection was successful
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
This commit is contained in:
parent
9e329c7997
commit
cf05b11924
1 changed files with 7 additions and 1 deletions
|
@ -772,8 +772,14 @@ static void tcp_connected(struct net_context *context,
|
|||
{
|
||||
/* Start to send data */
|
||||
sa_family_t family = POINTER_TO_UINT(user_data);
|
||||
const char *str_family = (family == AF_INET) ? "IPv4" : "IPv6";
|
||||
|
||||
NET_DBG("%s connected.", family == AF_INET ? "IPv4" : "IPv6");
|
||||
if (status < 0) {
|
||||
NET_ERR("Couldn't connect using %s: %d", str_family, status);
|
||||
return;
|
||||
}
|
||||
|
||||
NET_DBG("%s connected.", str_family);
|
||||
|
||||
if (family == AF_INET) {
|
||||
#if defined(CONFIG_NET_IPV4)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue