go.mod | 2 +- go.sum | 4 ++-- test/misc_test.go | 14 +++++++++++--- diff --git a/go.mod b/go.mod index 2e19887bdb980c0e030236f6832e265931783620..7c4caf4bca83163f011d5583851484cd4daacdf1 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ github.com/anacrolix/missinggo v1.3.0 github.com/anacrolix/missinggo/perf v1.0.0 github.com/anacrolix/missinggo/v2 v2.7.2-0.20230527121029-a582b4f397b9 github.com/anacrolix/multiless v0.3.0 - github.com/anacrolix/squirrel v0.4.1-0.20230623120945-75cf0ad9a958 + github.com/anacrolix/squirrel v0.4.1 github.com/anacrolix/sync v0.4.0 github.com/anacrolix/tagflag v1.3.0 github.com/anacrolix/upnp v0.1.3-0.20220123035249-922794e51c96 diff --git a/go.sum b/go.sum index 28ef842a5c51ee6336fbee665041cb3b6d3cf90c..f8678d40546263e93a1124e0536e270a75f5aa77 100644 --- a/go.sum +++ b/go.sum @@ -103,8 +103,8 @@ github.com/anacrolix/mmsg v1.0.0 h1:btC7YLjOn29aTUAExJiVUhQOuf/8rhm+/nWCMAnL3Hg= github.com/anacrolix/mmsg v1.0.0/go.mod h1:x8kRaJY/dCrY9Al0PEcj1mb/uFHwP6GCJ9fLl4thEPc= github.com/anacrolix/multiless v0.3.0 h1:5Bu0DZncjE4e06b9r1Ap2tUY4Au0NToBP5RpuEngSis= github.com/anacrolix/multiless v0.3.0/go.mod h1:TrCLEZfIDbMVfLoQt5tOoiBS/uq4y8+ojuEVVvTNPX4= -github.com/anacrolix/squirrel v0.4.1-0.20230623120945-75cf0ad9a958 h1:A+tNxHKFCGj/CP8WaQDZC+QwDjjoXUHDByIzKVyzKw4= -github.com/anacrolix/squirrel v0.4.1-0.20230623120945-75cf0ad9a958/go.mod h1:YzgVvikMdFD441oTWlNG189bpKabO9Sbf3uCSVgca04= +github.com/anacrolix/squirrel v0.4.1 h1:AmyXOEADG24keqgzutp+ioxJInpWHvVqeWOiHTbkeXk= +github.com/anacrolix/squirrel v0.4.1/go.mod h1:YzgVvikMdFD441oTWlNG189bpKabO9Sbf3uCSVgca04= github.com/anacrolix/stm v0.2.0/go.mod h1:zoVQRvSiGjGoTmbM0vSLIiaKjWtNPeTvXUSdJQA4hsg= github.com/anacrolix/stm v0.4.0 h1:tOGvuFwaBjeu1u9X1eIh9TX8OEedEiEQ1se1FjhFnXY= github.com/anacrolix/stm v0.4.0/go.mod h1:GCkwqWoAsP7RfLW+jw+Z0ovrt2OO7wRzcTtFYMYY5t8= diff --git a/test/misc_test.go b/test/misc_test.go index a72746c8eb055eb3a9ff31e552cd0c1df6b2c470..4661c1a803437569579cada49ae0d924e7354ca5 100644 --- a/test/misc_test.go +++ b/test/misc_test.go @@ -13,12 +13,13 @@ "github.com/anacrolix/torrent/metainfo" sqliteStorage "github.com/anacrolix/torrent/storage/sqlite" ) -func TestUseSourcesSqliteStorageClosed(t *testing.T) { +func TestSqliteStorageClosed(t *testing.T) { c := qt.New(t) cfg := torrent.TestingConfig(t) storage, err := sqliteStorage.NewDirectStorage(sqliteStorage.NewDirectStorageOpts{}) defer storage.Close() cfg.DefaultStorage = storage + cfg.Debug = true c.Assert(err, qt.IsNil) cl, err := torrent.NewClient(cfg) c.Assert(err, qt.IsNil) @@ -26,8 +27,15 @@ defer cl.Close() l, err := net.Listen("tcp", "localhost:0") c.Assert(err, qt.IsNil) defer l.Close() - // We need at least once piece to trigger a call to storage to determine completion state. - i := metainfo.Info{Pieces: make([]byte, metainfo.HashSize)} + // We need at least once piece to trigger a call to storage to determine completion state. We + // need non-zero content length to trigger piece hashing. + i := metainfo.Info{ + Pieces: make([]byte, metainfo.HashSize), + PieceLength: 1, + Files: []metainfo.FileInfo{ + {Length: 1}, + }, + } mi := metainfo.MetaInfo{} mi.InfoBytes, err = bencode.Marshal(i) c.Assert(err, qt.IsNil)