Bug #552

avatar

New seeding files cannot be opened

Added by Dave Lowndes 4846 days ago.

Status:New Start:12/12/2010
Priority:High Due date:
Assigned to:- % Done:

0%

Category:- Spent time: -
Target version:-
Votes: 0

Description

When I download a file and TorrentState changes from downloading to seeding I pass to a Windows Media Player control to open and play. The control cannot play the file.

When I restart the client application and the file exists on disk, it goes from hashing to seeding but this time I can open and play the file in Windows Media Player.

I am trying to open the file based on the TorrentStateChanged event.

I have inserted debugging code to try and open the file once seeding:

Stream stream = new FileStream(((TorrentFile)e.TorrentManager.Torrent.Files.First()).FullPath, FileMode.Open, FileAccess.Read, FileShare.Read);

If I try to read the file once state shifts from downloading >> seeding I get:

System.IO.IOException: The process cannot access the file 'C:\downloads\movie.mpg' because it is being used by another process

I don't not get this error if the file is on disk and state changes from hashing >> seeding.

There is a thread in the forums discussing this problem. One solution put forward:

hmm maybe there are still some buffers to write...
So we need to execute Looptask one time to empty the bufferedWrites before doing the flush....
Can you check if there are element in bufferedWrites , if yes execute Looptask one time.
Add this code in diskwriter.flush function...
I do not know very well this part, Alan have done all the work here. I am pretty sure he can find the bug here.

Using clientEngine.DiskManager.Flush(manager) does not solve the issue.

Also available in: Atom PDF