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
afaf6786
Commit
afaf6786
authored
Apr 20, 2023
by
Paul Gofman
Committed by
Alexandre Julliard
May 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Retry send on ECONNREFUSED in try_send().
parent
0e622f64
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
socket.c
dlls/ntdll/unix/socket.c
+12
-0
sock.c
dlls/ws2_32/tests/sock.c
+24
-1
No files found.
dlls/ntdll/unix/socket.c
View file @
afaf6786
...
...
@@ -984,6 +984,7 @@ static NTSTATUS try_send( int fd, struct async_send_ioctl *async )
{
union
unix_sockaddr
unix_addr
;
struct
msghdr
hdr
;
int
attempt
=
0
;
ssize_t
ret
;
memset
(
&
hdr
,
0
,
sizeof
(
hdr
)
);
...
...
@@ -1028,6 +1029,17 @@ static NTSTATUS try_send( int fd, struct async_send_ioctl *async )
else
if
(
errno
!=
EINTR
)
{
if
(
errno
!=
EWOULDBLOCK
)
WARN
(
"sendmsg: %s
\n
"
,
strerror
(
errno
)
);
/* ECONNREFUSED may be returned if this is connected datagram socket and the system received
* ICMP "destination port unreachable" message from the peer. That is ignored
* on Windows. The first sendmsg() will clear the error in this case and the next
* call should succeed. */
if
(
!
attempt
&&
errno
==
ECONNREFUSED
)
{
++
attempt
;
continue
;
}
return
sock_errno_to_status
(
errno
);
}
}
...
...
dlls/ws2_32/tests/sock.c
View file @
afaf6786
...
...
@@ -2962,7 +2962,9 @@ static void test_UDP(void)
/* peer 0 receives data from all other peers */
struct
sock_info
peer
[
NUM_UDP_PEERS
];
char
buf
[
16
];
int
ss
,
i
,
n_recv
,
n_sent
;
int
ss
,
i
,
n_recv
,
n_sent
,
ret
;
struct
sockaddr_in
addr
;
int
sock
;
memset
(
buf
,
0
,
sizeof
(
buf
));
for
(
i
=
NUM_UDP_PEERS
-
1
;
i
>=
0
;
i
--
)
{
...
...
@@ -3000,6 +3002,27 @@ static void test_UDP(void)
ok
(
n_recv
==
sizeof
(
buf
),
"UDP: recvfrom() received wrong amount of data or socket error: %d
\n
"
,
n_recv
);
ok
(
memcmp
(
&
peer
[
0
].
peer
.
sin_port
,
buf
,
sizeof
(
peer
[
0
].
addr
.
sin_port
)
)
==
0
,
"UDP: port numbers do not match
\n
"
);
}
sock
=
socket
(
AF_INET
,
SOCK_DGRAM
,
IPPROTO_UDP
);
ok
(
sock
!=
INVALID_SOCKET
,
"got error %u.
\n
"
,
WSAGetLastError
()
);
memset
(
&
addr
,
0
,
sizeof
(
addr
)
);
addr
.
sin_family
=
AF_INET
;
addr
.
sin_addr
.
s_addr
=
inet_addr
(
"127.0.0.1"
);
addr
.
sin_port
=
htons
(
255
);
ret
=
connect
(
sock
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
)
);
ok
(
!
ret
,
"got error %u.
\n
"
,
WSAGetLastError
()
);
/* Send to UDP socket succeeds even if the packets are not received and the network is replying with
* "destination port unreachable" ICMP messages. */
for
(
i
=
0
;
i
<
10
;
++
i
)
{
ret
=
send
(
sock
,
buf
,
sizeof
(
buf
),
0
);
ok
(
ret
==
sizeof
(
buf
),
"got %d, error %u.
\n
"
,
ret
,
WSAGetLastError
()
);
}
closesocket
(
sock
);
}
static
void
test_WSASocket
(
void
)
...
...
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