From de26b43716135e29e2b9e8e942fe8508ad6b1d09 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 7 Apr 2006 10:38:23 +0000 Subject: [PATCH] applied patch #1465378 - Speed up NSISdl downloads git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4643 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/NSISdl/nsisdl.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Contrib/NSISdl/nsisdl.cpp b/Contrib/NSISdl/nsisdl.cpp index 32caf80d..b03f55fd 100644 --- a/Contrib/NSISdl/nsisdl.cpp +++ b/Contrib/NSISdl/nsisdl.cpp @@ -380,8 +380,6 @@ __declspec(dllexport) void download (HWND parent, break; } - Sleep(25); - st = get->run (); if (st == -1) { @@ -423,7 +421,9 @@ __declspec(dllexport) void download (HWND parent, } } + int data_downloaded = 0; while ((len = get->bytes_available ()) > 0) { + data_downloaded++; if (len > 8192) len = 8192; len = get->get_bytes (buf, len); @@ -466,6 +466,8 @@ __declspec(dllexport) void download (HWND parent, } if (GetTickCount() > last_recv_time+timeout_ms) error = "Downloading timed out."; + else if (!data_downloaded) + Sleep(10); } else { error = "Bad response status.";