Module: tools Branch: master Commit: 2d8e40dad69c325415f927d37970a7849942f6b0 URL: https://source.winehq.org/git/tools.git/?a=commit;h=2d8e40dad69c325415f927d3...
Author: Francois Gouget fgouget@codeweavers.com Date: Tue Sep 24 11:04:13 2019 +0200
testbot/testagentd: Fix upgrades when there is more than one server running.
On Windows the second server will keep the old executable busy, preventing its deletion. So give up after a while. Usually the second server will be running with --set-time-only so upgrading it is not as important. If necessary this condition can be detected on the client by attempting to delete the old executable and checking for an error.
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
testbot/src/testagentd/platform_windows.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/testbot/src/testagentd/platform_windows.c b/testbot/src/testagentd/platform_windows.c index bb52a02..2d971a4 100644 --- a/testbot/src/testagentd/platform_windows.c +++ b/testbot/src/testagentd/platform_windows.c @@ -532,17 +532,20 @@ int platform_init(void) { /* This also serves to ensure the old server has released the port * before we attempt to open our own. + * But if a second server is running the deletion will never work so + * give up after a while. */ + int attempt = 0; do { if (!DeleteFileA(oldtestagentd)) Sleep(500); + attempt++; } - while (GetLastError() == ERROR_ACCESS_DENIED); + while (GetLastError() == ERROR_ACCESS_DENIED && attempt < 20); free(oldtestagentd); }
- wVersionRequested = MAKEWORD(2, 2); rc = WSAStartup(wVersionRequested, &wsaData); if (rc)