Skip to content

Commit

Permalink
Update FileEntry including torrent.Reader interface properly
Browse files Browse the repository at this point in the history
  • Loading branch information
zbhknight committed Dec 9, 2018
1 parent 23a6972 commit 1761a58
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions fileEntry.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,7 @@ type SeekableContent interface {
// FileEntry helps reading a torrent file.
type FileEntry struct {
*torrent.File
Reader *torrent.Reader
}

// Seek seeks to the correct file position, paying attention to the offset.
func (f FileEntry) Seek(offset int64, whence int) (int64, error) {
return (*f.Reader).Seek(offset+f.File.Offset(), whence)
}

func (f FileEntry) Read(p []byte) (n int, err error) {
return (*f.Reader).Read(p)
}

func (f FileEntry) Close() error {
return (*f.Reader).Close()
torrent.Reader
}

// NewFileReader sets up a torrent file for streaming reading.
Expand All @@ -44,6 +31,6 @@ func NewFileReader(f *torrent.File) (SeekableContent, error) {

return &FileEntry{
File: f,
Reader: &reader,
Reader: reader,
}, err
}

0 comments on commit 1761a58

Please sign in to comment.