Zebediah Figura : http.sys: Translate WSAEADDRINUSE to STATUS_SHARING_VIOLATION.
Alexandre Julliard
julliard at winehq.org
Mon Jan 27 15:00:16 CST 2020
Module: wine
Branch: master
Commit: 533acfb1f62233f875461c6527500b5a1165121e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=533acfb1f62233f875461c6527500b5a1165121e
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Fri Jan 24 13:55:37 2020 -0600
http.sys: Translate WSAEADDRINUSE to STATUS_SHARING_VIOLATION.
Fixes intermittent failures on the Debian 10 testbot.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/http.sys/http.c | 7 ++++++-
dlls/httpapi/tests/httpapi.c | 6 ++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/dlls/http.sys/http.c b/dlls/http.sys/http.c
index 91d81400e6..4259ca618f 100644
--- a/dlls/http.sys/http.c
+++ b/dlls/http.sys/http.c
@@ -1104,10 +1104,15 @@ static NTSTATUS http_add_url(struct request_queue *queue, IRP *irp)
addr.sin_addr.S_un.S_addr = INADDR_ANY;
if (bind(s, (struct sockaddr *)&addr, sizeof(addr)) == -1)
{
- ERR("Failed to bind socket, error %u.\n", WSAGetLastError());
LeaveCriticalSection(&http_cs);
closesocket(s);
heap_free(url);
+ if (WSAGetLastError() == WSAEADDRINUSE)
+ {
+ WARN("Address %s is already in use.\n", debugstr_a(params->url));
+ return STATUS_SHARING_VIOLATION;
+ }
+ ERR("Failed to bind socket, error %u.\n", WSAGetLastError());
return STATUS_UNSUCCESSFUL;
}
diff --git a/dlls/httpapi/tests/httpapi.c b/dlls/httpapi/tests/httpapi.c
index ee585948ab..a52a3f6c34 100644
--- a/dlls/httpapi/tests/httpapi.c
+++ b/dlls/httpapi/tests/httpapi.c
@@ -113,8 +113,9 @@ static unsigned short add_url_v1(HANDLE queue)
for (port = 50000; port < 51000; ++port)
{
swprintf(url, ARRAY_SIZE(url), L"http://localhost:%u/", port);
- if ((ret = HttpAddUrl(queue, url, NULL)) != ERROR_SHARING_VIOLATION)
+ if (!(ret = HttpAddUrl(queue, url, NULL)))
return port;
+ ok(ret == ERROR_SHARING_VIOLATION, "Failed to add %s, error %u.\n", debugstr_w(url), ret);
}
ok(0, "Failed to add url %s, error %u.\n", debugstr_w(url), ret);
return 0;
@@ -129,8 +130,9 @@ static ULONG add_url_v2(HTTP_URL_GROUP_ID group)
for (port = 50010; port < 51000; ++port)
{
swprintf(url, ARRAY_SIZE(url), L"http://localhost:%u/", port);
- if ((ret = pHttpAddUrlToUrlGroup(group, url, 0xdeadbeef, 0)) != ERROR_SHARING_VIOLATION)
+ if (!(ret = pHttpAddUrlToUrlGroup(group, url, 0xdeadbeef, 0)))
return port;
+ ok(ret == ERROR_SHARING_VIOLATION, "Failed to add %s, error %u.\n", debugstr_w(url), ret);
}
ok(0, "Failed to add url %s, error %u.\n", debugstr_w(url), ret);
return 0;
More information about the wine-cvs
mailing list