From: Matt Joiner <anacrolix@gmail.com>
Date: Mon, 24 May 2021 07:38:36 +0000 (+1000)
Subject: Add TODOs around setting info bytes
X-Git-Tag: v1.29.0~36
X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=d7c549d2e42de8498a021500857cbbd48b0c3ea4;p=btrtrc.git

Add TODOs around setting info bytes
---

diff --git a/torrent.go b/torrent.go
index 78d0f458..18a3f758 100644
--- a/torrent.go
+++ b/torrent.go
@@ -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.