[NebulousLabs/Sia] Simplify download handler and remove hardcoded sleep (#2780)

DavidVorick commented on this pull request.

> + var dw downloadDestination
+ var destinationType string
+ if isHTTPResp {
+ dw = newDownloadDestinationWriteCloserFromWriter(p.Httpwriter)
+ destinationType = «http stream»
+ } else {
+ osFile, err := os.OpenFile(p.Destination, os.O_CREATE|os.O_WRONLY, os.FileMode(file.mode))
+ if err != nil {
+ return nil, err
+ }
+ dw = osFile
+ destinationType = «file»
+ }
+
+ // Create the download object.
+ d, err := r.newDownload(downloadParams{

this needs to be changed to `r.managedNewDownload`.

Добавить комментарий