From f424c95a7f3835b1e85d0e9c7c2d49d3230100d1 Mon Sep 17 00:00:00 2001 From: ac-stef Date: Mon, 14 Sep 2015 16:02:38 +0200 Subject: [PATCH] allow the package server ping thread to take ages Don't have the main thread wait for the ping thread, because the ping thread may take a long time to respond - when a server connection can't be established. Sadly, there's no timeout for "connect()". --- source/src/autodownload.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/src/autodownload.cpp b/source/src/autodownload.cpp index e47b8d8d..5d1562c6 100644 --- a/source/src/autodownload.cpp +++ b/source/src/autodownload.cpp @@ -430,7 +430,11 @@ int downloadpackages(bool loadscr) // get all pending packages httpget h; canceldownloads = false; progress_of = loadscr ? pendingpackages.length() : -1; - sem_pckservers.wait(); + if(sem_pckservers.trywait()) + { // can't lock the server list -> this means, the server ping threads have not finished yet + if(pendingpackages.length()) conoutf("\f3failed to download packages: still pinging the servers..."); + return 0; + } pckservers.sort(pckserversort); loopv(pendingpackages) {