TachibanaGeneralLaboratories / download-navi

Free and Open Source software download manager
GNU General Public License v3.0
818 stars 86 forks source link

[Bug] Download not resuming if less free space than entire file #143

Closed KaKi87 closed 3 years ago

KaKi87 commented 3 years ago

Hello,

Let's say you have 1 GB of free space.

Try starting a 0.75 GB file download : it works.

At 0.5 GB downloaded, pause it.

You have now 0.5 GB of space left, which is more than the remaining 0.25 GB to download.

But, try resuming download : it fails.

My guess is : the app is expecting 1 GB of free space like if it was starting from the beginning.

Thanks

proninyaroslav commented 3 years ago

Try to disable pre-allocate disk space in the Settings -> Storage.

KaKi87 commented 3 years ago

I'll try, but will this be fixed?

proninyaroslav commented 3 years ago

In this case, this is not a bug, because you are trying to allocate space in advance, and if there is not enough disk space, then you will fail.

KaKi87 commented 3 years ago

Try starting a 0.75 GB file download : it works.

At this point, space allocation succeeded.

At 0.5 GB downloaded, pause it.

At this point, space allocation is preserved.

But, try resuming download : it fails.

At this point, space allocation should have been preserved.

proninyaroslav commented 3 years ago

Probably the problem is with this place. It checks the free space, but since the file size is already allocated, there is no free space, it just doesn't know that the space is already reserved. I need to think about how to implement it differently.

https://github.com/TachibanaGeneralLaboratories/download-navi/blob/45eec8ed3aab7e02c21c9dd997e04166d4e5f566/app/src/main/java/com/tachibana/downloader/core/model/DownloadThreadImpl.java#L401-L406

proninyaroslav commented 3 years ago

Fixed by https://github.com/TachibanaGeneralLaboratories/download-navi/commit/37379b5171ccd6c8fe8efc8ecca22d094d381665#diff-af5e49b2a79158a87cc304475c2710bfbc55a155464dd671b94dde07f20637a2

KaKi87 commented 3 years ago

Nice, thanks!