Only connect if needed
@@ -69,8 +69,9 @@ public class UrlDownloader {
}
public File waitFor(UrlReference urlReference, long timeout) {
- connect();
long start = System.currentTimeMillis() / 1000;
+ if (target == null || !target.isValid())
+ connect();
long timeLeft = timeout;
do {
Request request = new Request("url.waitFor");
