mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Use non-zero timeout for polling TCP connection
Allow poll to wait for a signal on the socket instead of requiring that it be set immediately. This fixes flakiness caused by connections not being established fast enough. For https://fxbug.dev/124433 PiperOrigin-RevId: 520212110
This commit is contained in:
@@ -354,7 +354,12 @@ CreateTCPConnectAcceptSocketPair(int bound, FileDescriptor connected, int type,
|
||||
if (connect_result == -1) {
|
||||
struct pollfd connect_poll = {connected.get(), POLLOUT | POLLERR | POLLHUP,
|
||||
0};
|
||||
RETURN_ERROR_IF_SYSCALL_FAIL(RetryEINTR(poll)(&connect_poll, 1, 0));
|
||||
int num_fds;
|
||||
RETURN_ERROR_IF_SYSCALL_FAIL(
|
||||
(num_fds = RetryEINTR(poll)(&connect_poll, 1, -1)));
|
||||
if (num_fds != 1) {
|
||||
return PosixError(ENOTCONN, "connect failed");
|
||||
}
|
||||
int error = 0;
|
||||
socklen_t errorlen = sizeof(error);
|
||||
RETURN_ERROR_IF_SYSCALL_FAIL(
|
||||
|
||||
Reference in New Issue
Block a user