warner/tahoe-lafs — pull request #3 by isnotajoke (2012-01-08 20:19:12+00:00)
Title: fixes for ticket 1648

The Retrieve class gets used both for downloading, validating, decoding and decrypting remote shares (writing the plaintext to a consumer) and for validating remote shares, since the steps to validate the shares of a file are a subset of the steps to assemble that file into plaintext. There were several assertions throughout the code path used by the verification process that didn't take the verification use case into account, since they implicitly assumed that having fewer than k active readers was an error. This is true in the case of downloading a file, since the Retrieve should be aborted with an error before proceeding down this code path in that case, but not for a verification, which can sensibly continue with fewer than k shares. These commits test that this case is handled correctly, remove the assertions so that verification operations with fewer than k shares don't fail due to an assertion error, and add code to Retrieve._download_current_segment to ensure that the verification operation is aborted if all of the shares are corrupt.