Commit 533acfb1 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

http.sys: Translate WSAEADDRINUSE to STATUS_SHARING_VIOLATION.

Fixes intermittent failures on the Debian 10 testbot. Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 62069b4e
......@@ -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;
}
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment