Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4e6a5d62
Commit
4e6a5d62
authored
Feb 15, 2023
by
Paul Gofman
Committed by
Alexandre Julliard
Feb 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Retry socket connection on ECONNABORTED error.
parent
fe9a1403
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
22 deletions
+38
-22
afd.c
dlls/ws2_32/tests/afd.c
+1
-7
sock.c
dlls/ws2_32/tests/sock.c
+26
-15
sock.c
server/sock.c
+11
-0
No files found.
dlls/ws2_32/tests/afd.c
View file @
4e6a5d62
...
...
@@ -569,13 +569,7 @@ static void test_poll(void)
ret
=
connect
(
client
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
));
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
todo_wine
ok
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
,
"got error %u
\n
"
,
WSAGetLastError
());
if
(
WSAGetLastError
()
==
WSAECONNABORTED
)
{
ret
=
connect
(
client
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
));
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
ok
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
,
"got error %u
\n
"
,
WSAGetLastError
());
}
ok
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
,
"got error %u
\n
"
,
WSAGetLastError
());
/* A subsequent poll call returns no events, or times out. However, this
* can't be reliably tested, as e.g. Linux will fail the connection
...
...
dlls/ws2_32/tests/sock.c
View file @
4e6a5d62
...
...
@@ -4352,13 +4352,7 @@ static void test_select(void)
ret
=
connect
(
fdWrite
,
(
const
struct
sockaddr
*
)
&
invalid_addr
,
sizeof
(
invalid_addr
));
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
todo_wine
ok
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
,
"got error %u
\n
"
,
WSAGetLastError
());
if
(
WSAGetLastError
()
==
WSAECONNABORTED
)
{
ret
=
connect
(
fdWrite
,
(
const
struct
sockaddr
*
)
&
invalid_addr
,
sizeof
(
invalid_addr
));
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
ok
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
,
"got error %u
\n
"
,
WSAGetLastError
());
}
ok
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
,
"got error %u
\n
"
,
WSAGetLastError
());
len
=
sizeof
(
id
);
id
=
0xdeadbeef
;
...
...
@@ -4380,13 +4374,7 @@ static void test_select(void)
ok
(
!
ret
,
"got error %u
\n
"
,
WSAGetLastError
());
ret
=
connect
(
fdWrite
,
(
const
struct
sockaddr
*
)
&
address
,
sizeof
(
address
));
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
todo_wine
ok
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
,
"got error %u
\n
"
,
WSAGetLastError
());
if
(
WSAGetLastError
()
==
WSAECONNABORTED
)
{
ret
=
connect
(
fdWrite
,
(
const
struct
sockaddr
*
)
&
address
,
sizeof
(
address
));
ok
(
ret
==
-
1
,
"got %d
\n
"
,
ret
);
ok
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
,
"got error %u
\n
"
,
WSAGetLastError
());
}
ok
(
WSAGetLastError
()
==
WSAEWOULDBLOCK
,
"got error %u
\n
"
,
WSAGetLastError
());
FD_ZERO_ALL
();
FD_SET
(
fdWrite
,
&
readfds
);
...
...
@@ -8320,7 +8308,6 @@ static void test_connect(void)
closesocket
(
connector
);
closesocket
(
acceptor
);
closesocket
(
listener
);
tcp_socketpair
(
&
connector
,
&
acceptor
);
...
...
@@ -8380,6 +8367,30 @@ static void test_connect(void)
WSACloseEvent
(
overlapped
.
hEvent
);
closesocket
(
connector
);
/* Test connect after previous connect attempt failure. */
connector
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
ok
(
connector
!=
INVALID_SOCKET
,
"failed to create socket, error %u
\n
"
,
WSAGetLastError
());
conaddress
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
);
conaddress
.
sin_port
=
htons
(
255
);
iret
=
connect
(
connector
,
(
struct
sockaddr
*
)
&
conaddress
,
sizeof
(
conaddress
));
ok
(
iret
==
-
1
,
"connection succeeded.
\n
"
);
ok
(
WSAGetLastError
()
==
WSAECONNREFUSED
,
"got error %u
\n
"
,
WSAGetLastError
());
set_blocking
(
connector
,
FALSE
);
iret
=
getsockname
(
listener
,
(
struct
sockaddr
*
)
&
address
,
&
addrlen
);
ok
(
!
iret
,
"failed to get address, error %u
\n
"
,
WSAGetLastError
());
iret
=
connect
(
connector
,
(
struct
sockaddr
*
)
&
address
,
sizeof
(
address
));
ok
(
iret
==
-
1
&&
WSAGetLastError
()
==
WSAEWOULDBLOCK
,
"unexpected iret %d, error %d.
\n
"
,
iret
,
WSAGetLastError
());
acceptor
=
accept
(
listener
,
NULL
,
NULL
);
ok
(
acceptor
!=
INVALID_SOCKET
,
"could not accept socket error %d
\n
"
,
WSAGetLastError
());
closesocket
(
acceptor
);
closesocket
(
connector
);
closesocket
(
listener
);
}
static
void
test_AcceptEx
(
void
)
...
...
server/sock.c
View file @
4e6a5d62
...
...
@@ -2602,6 +2602,17 @@ static void sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
unix_addr
.
in
.
sin_addr
.
s_addr
=
htonl
(
INADDR_LOOPBACK
);
ret
=
connect
(
unix_fd
,
&
unix_addr
.
addr
,
unix_len
);
if
(
ret
<
0
&&
errno
==
ECONNABORTED
)
{
/* On Linux with nonblocking socket if the previous connect() failed for any reason (including
* timeout), next connect will fail. If the error code was queried by getsockopt( SO_ERROR )
* the error code returned now is ECONNABORTED (otherwise that is the actual connect() failure
* error code). If we got here after previous connect attempt on the socket that means
* we already queried SO_ERROR in sock_error(), so retrying on ECONNABORTED only is
* sufficient. */
ret
=
connect
(
unix_fd
,
&
unix_addr
.
addr
,
unix_len
);
}
if
(
ret
<
0
&&
errno
!=
EINPROGRESS
)
{
set_error
(
sock_get_ntstatus
(
errno
)
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment