synchronized void addDownload(DownloadRequestStatus status) {
   RequestStatus old = requestsByIdentifier.put(status.getIdentifier(), status);
   if (logMINOR) Logger.minor(this, "Starting download " + status.getIdentifier());
   if (old == status) return;
   if (old != null) downloads.remove(old);
   downloads.add(status);
   downloadsByURI.put(status.getURI(), status);
 }
 /**
  * Restart a download. Caller should call ,false first, at which point we setStarted, and ,true
  * when it has actually started (a race condition means we don't setStarted at that point since
  * it's possible the success/failure callback might happen first).
  *
  * @param redirect If non-null, the request followed a redirect.
  */
 public synchronized void updateStarted(String identifier, FreenetURI redirect) {
   DownloadRequestStatus status = (DownloadRequestStatus) requestsByIdentifier.get(identifier);
   if (status == null) return; // Can happen during cancel etc.
   status.restart(false);
   if (redirect != null) {
     downloadsByURI.remove(status.getURI());
     status.redirect(redirect);
     downloadsByURI.put(redirect, status);
   }
 }