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

Pieces delete issue #471

Closed
YouROK opened this issue Mar 12, 2021 · 10 comments
Closed

Pieces delete issue #471

YouROK opened this issue Mar 12, 2021 · 10 comments

Comments

@YouROK
Copy link

YouROK commented Mar 12, 2021

Hi,
how do you properly delete pieces?
I have a download that goes into memory.
There is a certain cache, I open the reader, it reads and send to http.
If there are more pieces than the size of the cache, then the last read piece is released.

https://github.com/YouROK/TorrServer/blob/master/server/torr/storage/torrstor/cache.go
https://github.com/YouROK/TorrServer/blob/master/server/torr/storage/torrstor/piece.go

func (p *Piece) Release() {
	p.mu.Lock()
	defer p.mu.Unlock()
	if p.buffer != nil {
		p.buffer = nil
	}
	p.Size = 0
	p.complete = false

	p.cache.torrent.Piece(p.Id).SetPriority(torrent.PiecePriorityNone)
}

Everything is fine, until one moment, if I give these chunks a priority, it gives an error and does not upload.

Is there any way to reset the state of the piece as it was when the torrent was opened?

@vic1234
Copy link

vic1234 commented Jun 8, 2021

@anacrolix
Do you have any update on this issue?

@VuzzyM
Copy link

VuzzyM commented Jun 23, 2021

@anacrolix ???

@anacrolix
Copy link
Owner

I'm not sure I quite understand, however if the issue is around having a limited storage cache, there are improvements in master for this now. You can provide an indication to the Client of the available storage for each torrent, or even Client, and it will try to avoid thrashing and excessive readaheads. I suspect this could help. Please try master.

@VuzzyM
Copy link

VuzzyM commented Jun 25, 2021

I'm not sure I quite understand, however if the issue is around having a limited storage cache, there are improvements in master for this now. You can provide an indication to the Client of the available storage for each torrent, or even Client, and it will try to avoid thrashing and excessive readaheads. I suspect this could help. Please try master.

@YouROK

@YouROK
Copy link
Author

YouROK commented Jun 25, 2021

I use self storage with self pieces impl. In piece using mem buffer(slice) when all size of buffers is more than set in sets first buffer clean but=nil and os mem clean.

When reader seek start and begin read, client read piece as complete, but buffer is nil and completions impl sets to false. My piece return eof and client not readahead. Client read and reload torrent only in reader piece position

@VuzzyM
Copy link

VuzzyM commented Jun 25, 2021

I use self storage with self pieces impl. In piece using mem buffer(slice) when all size of buffers is more than set in sets first buffer clean but=nil and os mem clean.

When reader seek start and begin read, client read piece as complete, but buffer is nil and completions impl sets to false. My piece return eof and client not readahead. Client read and reload torrent only in reader piece position

@anacrolix

@anacrolix
Copy link
Owner

Client read and reload torrent only in reader piece position

I think I follow this part. On a read error, the client should try to refresh the completion state for the entire readahead window as an optimisation. I think you're suggesting that it doesn't?

It looks like it should here

r.t.updatePieceCompletion(index)

@VuzzyM
Copy link

VuzzyM commented Jun 26, 2021

Client read and reload torrent only in reader piece position

I think I follow this part. On a read error, the client should try to refresh the completion state for the entire readahead window as an optimisation. I think you're suggesting that it doesn't?

It looks like it should here

r.t.updatePieceCompletion(index)

@YouROK

@YouROK
Copy link
Author

YouROK commented Jul 19, 2021

Client read and reload torrent only in reader piece position

I think I follow this part. On a read error, the client should try to refresh the completion state for the entire readahead window as an optimisation. I think you're suggesting that it doesn't?

It looks like it should here

r.t.updatePieceCompletion(index)

Thx this help me in new version

@YouROK YouROK closed this as completed Jul 19, 2021
@anacrolix
Copy link
Owner

Thank you for following this up.

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

No branches or pull requests

4 participants