Skip to content

Commit 312e000

Browse files
rlubosdleach02
authored andcommitted
tests: net: socket: tls: Fix race on TCP socket close
One of the tests closed the underlying TCP connection right after establishing one. This caused a certain race between incoming TLS handshake data and entering FIN1 state (experienced on nrF52840), where the TLS handshake data could be received after the FIN1 state was entered, causing the server side to send RST packet. This disrupted the test flow, as graceful TCP connection teardown was expected. Fix this, by adding a small delay for such case to avoid the race. Signed-off-by: Robert Lubos <[email protected]>
1 parent 5cc1902 commit 312e000

File tree

1 file changed

+4
-0
lines changed
  • tests/net/socket/tls/src

1 file changed

+4
-0
lines changed

tests/net/socket/tls/src/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,10 @@ static void fake_tcp_server_work(struct k_work *work)
809809
test_accept(data->sock, &new_sock, NULL, 0);
810810

811811
if (!data->reply) {
812+
/* Add small delay to avoid race between incoming data and
813+
* sending FIN.
814+
*/
815+
k_msleep(10);
812816
goto out;
813817
}
814818

0 commit comments

Comments
 (0)