Skip to content
  • intrigeri's avatar
    Retry failed upgrade downloads, reusing the previously downloaded data, and... · 8b67924c
    intrigeri authored
    Retry failed upgrade downloads, reusing the previously downloaded data, and fallback to the DNS mirror pool
    
    This is the solution called "C + fallback DNS pool" on #15875.
    
    Incidentally, since the SocksPort we're using has IsolateDestAddr and
    IsolateDestPort, this also gives us "C + new Tor circuit" for the last retry in
    most cases (that is, unless the mirror picked from mirrors.json, that we tried
    to download from previously, is in the DNS pool, and we pick it again from from
    the DNS pool).
    
    This should allow the Upgrader to recover, transparently for the user, from
    a number of failure modes, such as:
    
     - We picked a mirror that's down or flaky.
     - We picked an out-of-sync mirror that lacks the data we need to download.
     - The user's Internet connection is flaky.
     - We picked a flaky Tor circuit.
    
    Regarding the added test scenarios:
    
     - For the "Successfully resuming an interrupted download, from the same mirror"
       scenario, I failed to find a simple enough way to set up a webserver that would
       fail once and then start working again, so I implemented the webserver mocking
       code directly in Tails::IUK::TargetFile::Download, which is not ideal.
    
     - For the "Successfully resuming an interrupted download, using the fallback
       mirror pool" scenario, I could have run a broken webserver and a functioning
       fallback one. But once I had the mocking code mentioned above, it was vastly
       simpler to just use it here as well.
    
    refs #15875
    8b67924c