Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Allow moving files at any point #604

Merged
merged 3 commits into from
Jan 25, 2023
Merged

Conversation

alanmcgovern
Copy link
Owner

The support to move files while the torrent is actively running was added as part of #445 .

Remove the code which prevents users from being able to do this.

Partially fixes: #598

The support to move files while the torrent is actively running was
added as part of #445 .

Remove the code which prevents users from being able to do this.

Partially fixes: #598
I had many concerns about the prior approach to closing excess
streams due to how it used a while loop and also async/await.

To keep things simple, make MaybeRemoveOldestStreams a non-async
method, so it's a bit easier to reason about what's happening.
The method now chooses the stream which should be disposed,
cleans up the internal state, and then queues that stream for
async disposal.

The engine does not have a strict limit on total open handles,
and it makes no promises about *precisely* how many filehandles
can be open at a given point in time, so the fact the dispose
is slightly async is still fine. If someone has an actual
hard limit on the exact number of file streams which can be
opened, then this delay is just one of many issues they'll
encounter.
This is just for tests, so if an error occurs due to disposing
the http listener, just catch it and ignore it.
@alanmcgovern alanmcgovern merged commit 64283e4 into master Jan 25, 2023
@alanmcgovern alanmcgovern deleted the move-files-while-running branch January 25, 2023 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using MoveFileAsync multiple times on a file can result in a deadlock
1 participant