Skip to content

Commit 71b94bc

Browse files
stig-bjorlykkerlubos
authored andcommitted
samples: net: http_server: No fatal error for setup_server
Creating a server socket for one family type may fail while the other family type works. Do not terminate with FATAL_ERROR() in this case. Signed-off-by: Stig Bjørlykke <[email protected]>
1 parent 4f3543d commit 71b94bc

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,9 @@ Matter samples
507507
Networking samples
508508
------------------
509509

510-
|no_changes_yet_note|
510+
* :ref:`http_server` sample:
511+
512+
* Fixed not to fail with a fatal error if IPv4 or IPv6 server setup fails.
511513

512514
NFC samples
513515
-----------

samples/net/http_server/src/main.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,6 @@ static void process_tcp4(void)
589589
ret = setup_server(&tcp4_sock, (struct sockaddr *)&addr4, sizeof(addr4));
590590
if (ret < 0) {
591591
LOG_ERR("Failed to create IPv4 socket %d", ret);
592-
FATAL_ERROR();
593592
return;
594593
}
595594

@@ -610,17 +609,17 @@ static void process_tcp6(void)
610609
};
611610

612611
ret = setup_server(&tcp6_sock, (struct sockaddr *)&addr6, sizeof(addr6));
612+
613+
k_sem_give(&ipv6_setup_sem);
614+
613615
if (ret < 0) {
614616
LOG_ERR("Failed to create IPv6 socket %d", ret);
615-
FATAL_ERROR();
616617
return;
617618
}
618619

619620
LOG_INF("Waiting for IPv6 HTTP connections on port %d, sock %d",
620621
SERVER_PORT, tcp6_sock);
621622

622-
k_sem_give(&ipv6_setup_sem);
623-
624623
while (true) {
625624
process_tcp(AF_INET6, &tcp6_sock, tcp6_accepted);
626625
}

0 commit comments

Comments
 (0)