tests/tcg/linux-test: Fix random hangs in test_socket

test_socket hangs randomly in connect(), especially when run without
qemu. Apparently the reason is that linux started treating backlog
value of 0 literally instead of rounding it up since v4.4 (commit
ef547f2ac16b).

So set it to 1 instead.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20220725144251.192720-1-iii@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Ilya Leoshkevich 2022-07-25 16:42:51 +02:00 committed by Thomas Huth
parent 3916603e0c
commit b9e6074fc5
1 changed files with 1 additions and 1 deletions

View File

@ -263,7 +263,7 @@ static int server_socket(void)
sockaddr.sin_port = htons(0); /* choose random ephemeral port) */
sockaddr.sin_addr.s_addr = 0;
chk_error(bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)));
chk_error(listen(fd, 0));
chk_error(listen(fd, 1));
return fd;
}