]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Add TODOs around setting info bytes
authorMatt Joiner <anacrolix@gmail.com>
Mon, 24 May 2021 07:38:36 +0000 (17:38 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 7 Jun 2021 02:57:09 +0000 (12:57 +1000)
torrent.go

index 78d0f45850153d838c861dddc92e0f5b5daf53f4..18a3f75859de1bc55129ca9ba7b12b9488d3a263 100644 (file)
@@ -387,6 +387,8 @@ func (t *Torrent) cacheLength() {
        t.length = &l
 }
 
+// TODO: This shouldn't fail for storage reasons. Instead we should handle storage failure
+// separately.
 func (t *Torrent) setInfo(info *metainfo.Info) error {
        if err := validateInfo(info); err != nil {
                return fmt.Errorf("bad info: %s", err)
@@ -1193,8 +1195,9 @@ func (t *Torrent) readAt(b []byte, off int64) (n int, err error) {
        return
 }
 
-// Returns an error if the metadata was completed, but couldn't be set for
-// some reason. Blame it on the last peer to contribute.
+// Returns an error if the metadata was completed, but couldn't be set for some reason. Blame it on
+// the last peer to contribute. TODO: Actually we shouldn't blame peers for failure to open storage
+// etc. Also we should probably cached metadata pieces per-Peer, to isolate failure appropriately.
 func (t *Torrent) maybeCompleteMetadata() error {
        if t.haveInfo() {
                // Nothing to do.