Skip to content

Commit 4eec9d9

Browse files
Tomasz Bursztykacfriedt
authored andcommitted
test/net: Make sure the tls server socket is accepting before connect
Client thread might run before the server gets to put itself on accept. Leading to the server waiting forever. Signed-off-by: Tomasz Bursztyka <[email protected]>
1 parent 32a5933 commit 4eec9d9

File tree

1 file changed

+3
-2
lines changed
  • tests/net/socket/tls/src

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ LOG_MODULE_REGISTER(net_test, CONFIG_NET_SOCKETS_LOG_LEVEL);
2424
#define MAX_CONNS 5
2525

2626
#define TCP_TEARDOWN_TIMEOUT K_SECONDS(1)
27-
#define THREAD_SLEEP 50 /* ms */
2827

2928
static const unsigned char psk[] = {
3029
0x01, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
@@ -72,13 +71,15 @@ static void test_listen(int sock)
7271

7372
static void test_connect(int sock, struct sockaddr *addr, socklen_t addrlen)
7473
{
74+
k_yield();
75+
7576
zassert_equal(connect(sock, addr, addrlen),
7677
0,
7778
"connect failed");
7879

7980
if (IS_ENABLED(CONFIG_NET_TC_THREAD_PREEMPTIVE)) {
8081
/* Let the connection proceed */
81-
k_msleep(THREAD_SLEEP);
82+
k_yield();
8283
}
8384
}
8485

0 commit comments

Comments
 (0)