For each file the client calculates the MD5 checksum and make sure that it matches, otherwise it tries again (until it's out of tries).
The client verifies the integrity of each file by calculating its MD5 checksum and comparing it to a stored value. If there's no match, it attempts again until reaching a predetermined limit on retries.